Skip to content

Commit db06d57

Browse files
committed
Fixed multiple course offerings returned for notification detection
1 parent 5cc865f commit db06d57

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

course-matrix/backend/src/services/emailNotificationService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,17 @@ export async function checkAndNotifyEvents() {
100100

101101
const formattedStartTime = now.toTimeString().slice(0, 8);
102102
const formattedEndTime = fifteenMinutesFromNow.toTimeString().slice(0, 8);
103-
103+
const today = now.toISOString().split('T')[0];
104+
//console.log(today);
104105
try {
105106
// Get events that start between now and 15 minutes from now
106107
const { data: events, error } = await supabaseServersideClient
107108
.schema("timetable")
108109
.from("course_events")
109110
.select("*")
110111
.gte("event_start", formattedStartTime)
111-
.lte("event_start", formattedEndTime);
112+
.lte("event_start", formattedEndTime)
113+
.eq("event_date", today);
112114

113115
if (error) {
114116
console.error("Error fetching events:", error);

0 commit comments

Comments
 (0)