@@ -3,6 +3,19 @@ import asyncHandler from "../middleware/asyncHandler";
33import { supabase } from "../db/setupDb" ;
44import { start } from "repl" ;
55
6+ function getReadingWeekStart ( start_date :string ) {
7+ return ( start_date === "2025-05-02" ) ? "2025-06-15"
8+ : ( start_date === "2025-09-02" ) ? "2025-10-26"
9+ : "2026-02-16" ;
10+
11+ }
12+
13+ function getReadingWeekEnd ( start_date :string ) {
14+ return ( start_date === "2025-05-02" ) ? "2025-06-22"
15+ : ( start_date === "2025-09-02" ) ? "2025-11-01"
16+ : "2026-02-22" ;
17+
18+ }
619/**
720 * Helper method to generate weekly course events.
821 * @param courseEventName - The name of the course event (typically derived from the offering code and meeting section).
@@ -66,6 +79,10 @@ export function generateWeeklyCourseEvents(
6679 FR : 5 ,
6780 SA : 6 ,
6881 } ;
82+
83+ const rw_start = new Date ( getReadingWeekStart ( semester_start_date ) + "T00:00:00-05:00" ) ;
84+ const rw_end = new Date ( getReadingWeekEnd ( semester_start_date ) + "T00:00:00-05:00" ) ;
85+
6986
7087 const targetWeekday = weekdayMap [ courseDay ] ;
7188 if ( targetWeekday === undefined ) {
@@ -91,6 +108,7 @@ export function generateWeeklyCourseEvents(
91108 let eventsToInsert : any [ ] = [ ] ;
92109 //Loop through the semester, adding an event for each week on the targeted weekday
93110 while ( currentDate <= semesterEndObj ) {
111+ if ( currentDate < rw_start || currentDate > rw_end ) {
94112 eventsToInsert . push ( {
95113 user_id,
96114 calendar_id,
@@ -102,6 +120,7 @@ export function generateWeeklyCourseEvents(
102120 event_description : null ,
103121 offering_id,
104122 } ) ;
123+ }
105124 //Cycle to the next week
106125 currentDate . setDate ( currentDate . getDate ( ) + 7 ) ;
107126 }
0 commit comments