Skip to content

Commit

Permalink
Coalesce null annotation values, to better rank them against annotati…
Browse files Browse the repository at this point in the history
…ons with value 0
  • Loading branch information
deluan committed Dec 2, 2023
1 parent cdccdc5 commit 595186b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion persistence/sql_annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 595186b

Please sign in to comment.