From ba088e7b14c5720b761bd5eb904b8b6eb95a51db Mon Sep 17 00:00:00 2001 From: Deluan Date: Sat, 5 Sep 2026 02:09:53 -0400 Subject: [PATCH] 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'. --- persistence/sql_annotations.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/persistence/sql_annotations.go b/persistence/sql_annotations.go index 10e3ccb79..48e5ba93e 100644 --- a/persistence/sql_annotations.go +++ b/persistence/sql_annotations.go @@ -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)) } }