mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-18 07:30:29 +00: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
@ -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…
x
Reference in New Issue
Block a user