diff --git a/routes/publishedSchedule.js b/routes/publishedSchedule.js index 749be96..5747bff 100644 --- a/routes/publishedSchedule.js +++ b/routes/publishedSchedule.js @@ -51,7 +51,7 @@ publishedScheduleRouter.get('/recently-added', async (req, res) => { PS.created_on FROM published_schedule PS LEFT JOIN catalog C ON PS.event_id = C.id - WHERE PS.created_on = PS.confirmed_on AND PS.created_on > current_date - 7 AND confirmed = true + WHERE PS.created_on > current_date - 7 AND confirmed = true ORDER BY created_on DESC; `, ); @@ -237,7 +237,7 @@ publishedScheduleRouter.get('/stats', async (req, res) => { FROM all_event_types aet CROSS JOIN all_subjects asu ) - SELECT + 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 @@ -406,7 +406,7 @@ publishedScheduleRouter.post('/', async (req, res) => { eventId, dayId, confirmed, - new Date(), + null, startTime, endTime, calculateYear(eventDate, cohort), diff --git a/server/schema/published_schedule.sql b/server/schema/published_schedule.sql index ee3feee..a00a378 100644 --- a/server/schema/published_schedule.sql +++ b/server/schema/published_schedule.sql @@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS published_schedule ( event_id integer NOT NULL, day_id integer NOT NULL, confirmed boolean NOT NULL, - confirmed_on date NOT NULL, + confirmed_on date, start_time time NOT NULL, end_time time NOT NULL, cohort varchar[] NOT NULL, @@ -16,4 +16,4 @@ CREATE TABLE IF NOT EXISTS published_schedule ( REFERENCES day (id) ON DELETE CASCADE ); -CREATE INDEX idx_day_id ON published_schedule (day_id); \ No newline at end of file +CREATE INDEX idx_day_id ON published_schedule (day_id);