From dc1ca99ba0c1d77b88dea241ba9a00b2941e5b49 Mon Sep 17 00:00:00 2001 From: ThatMegamind Date: Sun, 12 May 2024 16:34:49 -0700 Subject: [PATCH] stat totals remove duplicates --- routes/publishedSchedule.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/publishedSchedule.js b/routes/publishedSchedule.js index a0ba8f3..099c46c 100644 --- a/routes/publishedSchedule.js +++ b/routes/publishedSchedule.js @@ -246,12 +246,12 @@ publishedScheduleRouter.get('/stats', async (req, res) => { SELECT COALESCE(ap.event_type::text, 'Total') AS event_type, COALESCE(ap.subject::text, 'Total') AS subject, - COALESCE(COUNT(c.catalog_id), 0) AS total_count + COALESCE(COUNT(DISTINCT ps_event_id), 0) AS total_count FROM all_permutations ap LEFT JOIN ( SELECT *, ps.day_id AS ps_day_id, - c.id AS catalog_id + ps.id AS ps_event_id FROM catalog c JOIN published_schedule ps ON c.id = ps.event_id JOIN day d ON PS.day_id = d.id