Skip to content

Commit

Permalink
group by date instead of timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheryl Chen committed Jan 30, 2024
1 parent 1310260 commit 4e0682e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions routes/publishedSchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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],
);
Expand Down

0 comments on commit 4e0682e

Please sign in to comment.