From b7ae383e656f0af14bfa37a0be8dca7947cc70ba Mon Sep 17 00:00:00 2001 From: maciejpedzich Date: Sun, 24 Jul 2022 11:21:43 +0200 Subject: [PATCH] Ensure each day is displayed in the follower chart --- components/stats/FollowerGrowth.vue | 2 +- server/api/playlists/[playlistId]/snapshots.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/stats/FollowerGrowth.vue b/components/stats/FollowerGrowth.vue index c112f93..790e894 100644 --- a/components/stats/FollowerGrowth.vue +++ b/components/stats/FollowerGrowth.vue @@ -56,7 +56,7 @@ const { pending, error, data, refresh } = await useLazyAsyncData( async () => { const snapshots = ( await $fetch( - `/api/playlists/${playlistId}/snapshots?sinceDate=${sinceDate.value}` + `/api/playlists/${playlistId}/snapshots?sinceDate=${sinceDate.value}&allowDuplicates=yes` ) ).reverse(); diff --git a/server/api/playlists/[playlistId]/snapshots.ts b/server/api/playlists/[playlistId]/snapshots.ts index 40d1bb6..edc3539 100644 --- a/server/api/playlists/[playlistId]/snapshots.ts +++ b/server/api/playlists/[playlistId]/snapshots.ts @@ -50,6 +50,8 @@ export default defineEventHandler(async (event) => { }) ); + if (query.allowDuplicates === 'yes') return possiblyDuplicateSnapshotEntries; + // Since commit listings are sorted by the latest dateCaptured first, // the following will preserve the last item with a duplicate key value. // Therefore, we'll be left with entries containing the earliest dateCaptured.