From 50bb55536f63588d890fc5b348eeecdb39f639ba Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 26 Oct 2022 15:48:46 -0700 Subject: [PATCH] albums: add list --- lib/Db/TimelineQueryAlbums.php | 19 ++++++++++++++++--- src/components/Timeline.vue | 9 +++------ src/components/frame/Tag.vue | 13 ++++++++++++- src/services/DavRequests.ts | 23 +++++++++++++++++++++-- src/services/Utils.ts | 10 ++++++++-- src/types.ts | 15 +++++++++++++++ 6 files changed, 75 insertions(+), 14 deletions(-) diff --git a/lib/Db/TimelineQueryAlbums.php b/lib/Db/TimelineQueryAlbums.php index aeaf1c90..86df0636 100644 --- a/lib/Db/TimelineQueryAlbums.php +++ b/lib/Db/TimelineQueryAlbums.php @@ -15,11 +15,24 @@ trait TimelineQueryAlbums $query = $this->connection->getQueryBuilder(); // SELECT everything from albums - $query->select('*')->from('photos_albums', 'pa')->where( + $count = $query->func()->count($query->createFunction('DISTINCT m.fileid'), 'count'); + $query->select('pa.*', $count)->from('photos_albums', 'pa')->where( $query->expr()->eq('user', $query->createNamedParameter($uid)), ); + // WHERE there are items with this tag + $query->innerJoin('pa', 'photos_albums_files', 'paf', $query->expr()->andX( + $query->expr()->eq('paf.album_id', 'pa.album_id'), + )); + + // WHERE these items are memories indexed photos + $query->innerJoin('paf', 'memories', 'm', $query->expr()->eq('m.fileid', 'paf.file_id')); + + // WHERE these photos are in the filecache + $query->innerJoin('m', 'filecache', 'f', $query->expr()->eq('m.fileid', 'f.fileid'),); + // GROUP and ORDER by + $query->groupBy('pa.album_id'); $query->orderBy('pa.created', 'DESC'); $query->addOrderBy('pa.album_id', 'DESC'); // tie-breaker @@ -28,8 +41,8 @@ trait TimelineQueryAlbums // Post process foreach ($albums as &$row) { - $row['album_id'] = (int) $row['id']; - $row['created'] = (int) $row['count']; + $row['album_id'] = (int) $row['album_id']; + $row['created'] = (int) $row['created']; $row['last_added_photo'] = (int) $row['last_added_photo']; } diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 96aaf2be..84b9f24e 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -52,7 +52,7 @@ {{ item.super }}
- + {{ item.name || getHeadName(item) }}
@@ -516,9 +516,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { } // Special headers - if (head.dayId === this.TagDayID.FOLDERS) { - return (head.name = this.t("memories", "Folders")); - } else if (head.dayId === this.TagDayID.TAGS || head.dayId === this.TagDayID.FACES) { + if (this.TagDayIDValueSet.has(head.dayId)) { return (head.name = ""); } @@ -637,8 +635,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { }; // Special headers - if (day.dayid === this.TagDayID.TAGS || - day.dayid === this.TagDayID.FACES) { + if (this.TagDayIDValueSet.has(day.dayid)) { head.size = 10; } else if (this.$route.name === 'thisday' && (!prevDay || Math.abs(prevDay.dayid - day.dayid) > 30)) { // thisday view with new year title diff --git a/src/components/frame/Tag.vue b/src/components/frame/Tag.vue index 97baa01f..3fbbf8e6 100644 --- a/src/components/frame/Tag.vue +++ b/src/components/frame/Tag.vue @@ -26,7 +26,7 @@