From 5b1cab9f9139511cc848ccbc120c3ba7b59f5c69 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Thu, 3 Aug 2023 22:44:28 -0700 Subject: [PATCH] albums: fix sort order Signed-off-by: Varun Patil --- lib/Db/AlbumsQuery.php | 2 -- src/services/dav/albums.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/Db/AlbumsQuery.php b/lib/Db/AlbumsQuery.php index 1e84d0d2..8254d388 100644 --- a/lib/Db/AlbumsQuery.php +++ b/lib/Db/AlbumsQuery.php @@ -64,8 +64,6 @@ class AlbumsQuery // GROUP and ORDER by $query->groupBy('pa.album_id'); - $query->orderBy('pa.created', 'DESC'); - $query->addOrderBy('pa.album_id', 'DESC'); // tie-breaker // WHERE these albums contain fileid if specified if ($fileid) { diff --git a/src/services/dav/albums.ts b/src/services/dav/albums.ts index a677f464..58fb29a3 100644 --- a/src/services/dav/albums.ts +++ b/src/services/dav/albums.ts @@ -36,7 +36,7 @@ export async function getAlbums(sort: 1 | 2 = 1, fileid?: number) { data.sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' })); break; default: - data.sort((a, b) => b.last_added_photo - a.last_added_photo); + data.sort((a, b) => b.created - a.created); } return data;