feat(legacy): order by filename when lptime is null (#3069)
### Description It is good to have a deterministic order when doing explicit file sorting. This sorts by filename when last played time is null. I would expect filename to be the next sort after last played time in case of a tie, and was surprised to find it was not explicit. It should not break any existing use cases. **This is a new feature**: Kind of? **I have updated the documentation to reflect these changes**: I did not update any documentation as this way seems like the logical expected way to do the sort. ### Testing Notes **What I did:** I loaded up some tracks into a local libretime instance, let some of them play, and tested that all the old sorts worked as before as well as tracks getting sorted by filepath in case of a last played time
This commit is contained in:
parent
c883d0f2d5
commit
8c26505622
|
@ -1633,12 +1633,10 @@ SQL;
|
||||||
$qry->addDescendingOrderByColumn('utime');
|
$qry->addDescendingOrderByColumn('utime');
|
||||||
} elseif ($sortTracks == 'oldest') {
|
} elseif ($sortTracks == 'oldest') {
|
||||||
$qry->addAscendingOrderByColumn('utime');
|
$qry->addAscendingOrderByColumn('utime');
|
||||||
}
|
} elseif ($sortTracks == 'mostrecentplay') {
|
||||||
// these sort additions are needed to override the default postgres NULL sort behavior
|
$qry->addAscendingOrderByColumn('lptime DESC NULLS LAST, filepath');
|
||||||
elseif ($sortTracks == 'mostrecentplay') {
|
|
||||||
$qry->addDescendingOrderByColumn('(lptime IS NULL), lptime');
|
|
||||||
} elseif ($sortTracks == 'leastrecentplay') {
|
} elseif ($sortTracks == 'leastrecentplay') {
|
||||||
$qry->addAscendingOrderByColumn('(lptime IS NOT NULL), lptime');
|
$qry->addAscendingOrderByColumn('lptime ASC NULLS FIRST, filepath');
|
||||||
} elseif ($sortTracks == 'random') {
|
} elseif ($sortTracks == 'random') {
|
||||||
$qry->addAscendingOrderByColumn('random()');
|
$qry->addAscendingOrderByColumn('random()');
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue