From 0bc94b90d77a802ab33ec5261842ef67a0c19069 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Wed, 26 Jul 2023 01:45:28 +0200 Subject: [PATCH] SmartPlaylistSearchTerm: Handle unrated (-1) as zero Fixes #1244 --- src/smartplaylists/smartplaylistsearchterm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smartplaylists/smartplaylistsearchterm.cpp b/src/smartplaylists/smartplaylistsearchterm.cpp index 120e3082..727990c3 100644 --- a/src/smartplaylists/smartplaylistsearchterm.cpp +++ b/src/smartplaylists/smartplaylistsearchterm.cpp @@ -95,7 +95,7 @@ QString SmartPlaylistSearchTerm::ToSql() const { } } else if (TypeOf(field_) == Type::Rating) { - col = "CAST ((" + col + " + 0.05) * 10 AS INTEGER)"; + col = "CAST ((replace(" + col + ", -1, 0) + 0.05) * 10 AS INTEGER)"; value = "CAST ((" + value + " + 0.05) * 10 AS INTEGER)"; }