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
This commit is contained in:
Bobby 2022-05-05 14:54:21 +07:00
parent ecdeaa8b8a
commit 395361d5fc
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09

View File

@ -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')