mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Fix values from annotation table cannot be compared to 0
Solves this issue: https://github.com/navidrome/navidrome/issues/1417#issuecomment-974052454
This commit is contained in:
parent
4bf4765442
commit
92c31c961d
3 changed files with 58 additions and 43 deletions
|
@ -22,15 +22,25 @@ type Criteria struct {
|
|||
}
|
||||
|
||||
func (c Criteria) OrderBy() string {
|
||||
if c.Sort == "" {
|
||||
c.Sort = "title"
|
||||
}
|
||||
f := fieldMap[strings.ToLower(c.Sort)]
|
||||
if f == "" {
|
||||
var mapped string
|
||||
if f == nil {
|
||||
log.Error("Invalid field in 'sort' field", "field", c.Sort)
|
||||
f = c.Sort
|
||||
mapped = c.Sort
|
||||
} else {
|
||||
if f.order == "" {
|
||||
mapped = f.field
|
||||
} else {
|
||||
mapped = f.order
|
||||
}
|
||||
}
|
||||
if c.Order != "" {
|
||||
f = f + " " + c.Order
|
||||
mapped = mapped + " " + c.Order
|
||||
}
|
||||
return f
|
||||
return mapped
|
||||
}
|
||||
|
||||
func (c Criteria) ToSql() (sql string, args []interface{}, err error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue