mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-22 09:17:13 +02:00
fix(pglite): keep the has_rating filter numeric
annotationBoolFilter serves both starred (boolean) and rating (integer); the boolean form broke the Top Rated lists with 'COALESCE types integer and boolean cannot be matched'.
This commit is contained in:
parent
61f7934a3b
commit
ba088e7b14
1 changed files with 8 additions and 1 deletions
|
|
@ -95,7 +95,14 @@ func annotationBoolFilter(field string) func(string, any) Sqlizer {
|
|||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return Expr(fmt.Sprintf("COALESCE(%s, false) = %t", field, strings.ToLower(v) == "true"))
|
||||
set := strings.ToLower(v) == "true"
|
||||
if field == "rating" { // integer column; starred is a boolean
|
||||
if set {
|
||||
return Expr("COALESCE(rating, 0) > 0")
|
||||
}
|
||||
return Expr("COALESCE(rating, 0) = 0")
|
||||
}
|
||||
return Expr(fmt.Sprintf("COALESCE(%s, false) = %t", field, set))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue