From 9351bef61cc332de12fa33cccf28522381e32657 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 20 Jun 2021 15:56:02 -0400 Subject: [PATCH] Add preview category to leaderboard --- src/routes/getTopUsers.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/getTopUsers.ts b/src/routes/getTopUsers.ts index 6a8abd6..66cee03 100644 --- a/src/routes/getTopUsers.ts +++ b/src/routes/getTopUsers.ts @@ -21,7 +21,8 @@ async function generateTopUsersStats(sortBy: string, categoryStatsEnabled: boole SUM(CASE WHEN category = 'outro' THEN 1 ELSE 0 END) as "categorySumOutro", SUM(CASE WHEN category = 'interaction' THEN 1 ELSE 0 END) as "categorySumInteraction", SUM(CASE WHEN category = 'selfpromo' THEN 1 ELSE 0 END) as "categorySelfpromo", - SUM(CASE WHEN category = 'music_offtopic' THEN 1 ELSE 0 END) as "categoryMusicOfftopic", `; + SUM(CASE WHEN category = 'music_offtopic' THEN 1 ELSE 0 END) as "categoryMusicOfftopic", + SUM(CASE WHEN category = 'preview' THEN 1 ELSE 0 END) as "categorySumPreview", `; } const rows = await db.prepare('all', `SELECT COUNT(*) as "totalSubmissions", SUM(views) as "viewCount", @@ -48,6 +49,7 @@ async function generateTopUsersStats(sortBy: string, categoryStatsEnabled: boole rows[i].categorySumInteraction, rows[i].categorySelfpromo, rows[i].categoryMusicOfftopic, + rows[i].categorySumPreview ]; } }