Skip to content

Commit

Permalink
Fix the smartlist play history filters not working on PostgreSQL
Browse files Browse the repository at this point in the history
The related SQL sorting rules applied the LOWER() function on
play_count and last_played columns which was a copy-paste error and
made no sense. On MySQL/MariaDB and SQLite, this made no harm but on
PostgreSQL, this broke the DB query.
  • Loading branch information
paulijar committed Sep 20, 2023
1 parent 4d1babc commit 3b1db7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Db/TrackMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ protected function formatSortingClause(int $sortBy, bool $invertSort = false) :
// Note: the alternative form "LOWER(`artist_name`) wouldn't work on PostgreSQL, see https://github.com/owncloud/music/issues/1046 for a similar case
return "ORDER BY LOWER(`artist`.`name`) $dir, LOWER(`title`) $dir";
case SortBy::PlayCount:
return "ORDER BY LOWER(`play_count`) $dir";
return "ORDER BY `play_count` $dir";
case SortBy::LastPlayed:
return "ORDER BY LOWER(`last_played`) $dir";
return "ORDER BY `last_played` $dir";
default:
return parent::formatSortingClause($sortBy, $invertSort);
}
Expand Down

0 comments on commit 3b1db7a

Please sign in to comment.