From 4e0682e05c59637b0b984e38ad9f4cf1ebbe433a Mon Sep 17 00:00:00 2001 From: Cheryl Chen Date: Mon, 29 Jan 2024 16:39:11 -0800 Subject: [PATCH] group by date instead of timestamp --- routes/publishedSchedule.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routes/publishedSchedule.js b/routes/publishedSchedule.js index d43c3cb..18b5c44 100644 --- a/routes/publishedSchedule.js +++ b/routes/publishedSchedule.js @@ -33,7 +33,7 @@ publishedScheduleRouter.get('/', async (req, res) => { // GET /published-schedule/season - returns rows that match the season publishedScheduleRouter.get('/season', async (req, res) => { try { - const { year, season } = req.query; + const { season, year } = req.query; const seasonResult = await db.query( ` WITH seasonPS AS @@ -55,10 +55,10 @@ publishedScheduleRouter.get('/season', async (req, res) => { C.season = $1 AND EXTRACT(YEAR FROM PS.start_time) = $2 ) - SELECT seasonPS.start_time, JSON_AGG(seasonPS.*) AS data + SELECT DATE(seasonPS.start_time), JSON_AGG(seasonPS.*) AS data FROM seasonPS - GROUP BY start_time - ORDER BY start_time ASC; + GROUP BY DATE(start_time) + ORDER BY DATE(start_time) ASC; `, [season, year], );