mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-19 04:50:16 +01:00
smart playlists: 'on date' (equals for dates) operator was too precise (fixes issue #1174)
This commit is contained in:
parent
3b7ae72f82
commit
be5eb7a9fb
@ -48,6 +48,12 @@ QString SearchTerm::ToSql() const {
|
||||
if (TypeOf(field_) == Type_Rating) {
|
||||
col = "CAST ((" + col + " + 0.05) * 10 AS INTEGER)";
|
||||
value = "CAST ((" + value + " + 0.05) * 10 AS INTEGER)";
|
||||
|
||||
// The calendar widget specifies no time so ditch the possible time part
|
||||
// from integers representing the dates.
|
||||
} else if (TypeOf(field_) == Type_Date) {
|
||||
col = "DATE(" + col + ", 'unixepoch', 'localtime')";
|
||||
value = "DATE(" + value + ", 'unixepoch', 'localtime')";
|
||||
}
|
||||
|
||||
switch (operator_) {
|
||||
@ -62,17 +68,20 @@ QString SearchTerm::ToSql() const {
|
||||
case Op_Equals:
|
||||
if (TypeOf(field_) == Type_Text)
|
||||
return col + " LIKE '" + value + "'";
|
||||
else if (TypeOf(field_) == Type_Rating)
|
||||
else if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date)
|
||||
return col + " = " + value + "";
|
||||
else
|
||||
return col + " = '" + value + "'";
|
||||
case Op_GreaterThan:
|
||||
if (TypeOf(field_) == Type_Rating)
|
||||
if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date)
|
||||
return col + " > " + value + "";
|
||||
else
|
||||
return col + " > '" + value + "'";
|
||||
case Op_LessThan:
|
||||
if (TypeOf(field_) == Type_Rating)
|
||||
if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date)
|
||||
return col + " < " + value + "";
|
||||
else
|
||||
return col + " < '" + value + "'";
|
||||
|
Loading…
Reference in New Issue
Block a user