From b36064ae319ac3eccc097bced658ae72884e3492 Mon Sep 17 00:00:00 2001 From: ThatMegamind <92563733+ThatMegamind@users.noreply.github.com> Date: Tue, 14 May 2024 13:25:33 -0700 Subject: [PATCH] stat totals remove duplicates (#71) Co-authored-by: michellelin1 <66575725+michellelin1@users.noreply.github.com> --- 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