Skip to content

Commit

Permalink
Added handling for custom events download (#1015)
Browse files Browse the repository at this point in the history
Co-authored-by: Vincent Ho <[email protected]>
  • Loading branch information
vinnyho and Vincent Ho authored Nov 18, 2024
1 parent 25405c3 commit 681aaf3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/antalmanac/src/lib/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export function getEventsFromCourses(
events = AppStore.getEventsWithFinalsInCalendar(),
term = getDefaultTerm(events).shortName
): EventAttributes[] {
const customEventIDs = new Set();
const calendarEvents = events.flatMap((event) => {
if (event.isCustomEvent) {
// FIXME: We don't have a way to get the term for custom events,
Expand All @@ -271,6 +272,11 @@ export function getEventsFromCourses(
{ hour: start.getHours(), minute: start.getMinutes() },
{ hour: end.getHours(), minute: end.getMinutes() }
);
const customEventID = event.customEventID;
if (customEventIDs.has(customEventID)) {
return [];
}
customEventIDs.add(customEventID);
const customEvent: EventAttributes = {
productId: 'antalmanac/ics',
startOutputType: 'local' as const,
Expand Down

0 comments on commit 681aaf3

Please sign in to comment.