Skip to content

🎧 Your Personal Streaming Service

Coalesce null annotation values, to better rank them against annotations with value 0

Deluan595186b1b283
diff --git a/persistence/sql_annotations.go b/persistence/sql_annotations.go
index 8e26fcf7f..58c35965f 100644
--- a/persistence/sql_annotations.go
+++ b/persistence/sql_annotations.go
@@ -19,7 +19,13 @@ func (r sqlRepository) newSelectWithAnnotation(idField string, options ...model.
"annotation.item_id = "+idField+
" AND annotation.item_type = '"+r.tableName+"'"+
" AND annotation.user_id = '"+userId(r.ctx)+"')").
- Columns("starred", "starred_at", "play_count", "play_date", "rating")
+ Columns(
+ "coalesce(starred, 0) as starred",
+ "coalesce(rating, 0) as rating",
+ "coalesce(play_count, 0) as play_count",
+ "starred_at",
+ "play_date",
+ )
}
func (r sqlRepository) annId(itemID ...string) And {