From 395361d5fc1e5560796f2f2391f5359baabf3f56 Mon Sep 17 00:00:00 2001 From: Bobby Date: Thu, 5 May 2022 14:54:21 +0700 Subject: [PATCH] fix: count of album zips generated in stats change logic to list physical files instead, since the zipGeneratedAt attribute may still exist despite site owners having already done physical clean-ups --- controllers/utilsController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/utilsController.js b/controllers/utilsController.js index 3794829..eb4a00a 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -967,9 +967,12 @@ self.stats = async (req, res, next) => { activeAlbums.push(album.id) if (album.download) stats[data.title].Downloadable++ if (album.public) stats[data.title].Public++ - if (album.zipGeneratedAt) stats[data.title]['ZIP Generated']++ } + await paths.readdir(paths.zips).then(files => { + stats[data.title]['ZIP Generated'] = files.length + }).catch(() => {}) + stats[data.title]['Files in albums'] = await db.table('files') .whereIn('albumid', activeAlbums) .count('id as count')