From 3ff06e043b112bc232c9c173e72b2ea99609cf7a Mon Sep 17 00:00:00 2001 From: Samuel Gunter Date: Mon, 30 Sep 2024 22:43:09 -0500 Subject: [PATCH] fix: support classes with no location (#242) --- src/shared/types/CourseSchedule.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/shared/types/CourseSchedule.ts b/src/shared/types/CourseSchedule.ts index 68b75308..968ace7a 100644 --- a/src/shared/types/CourseSchedule.ts +++ b/src/shared/types/CourseSchedule.ts @@ -72,10 +72,12 @@ export class CourseSchedule { days, startTime, endTime, - location: { - building: location[0] ?? '', - room: location[1] ?? '', - }, + location: location[0] + ? { + building: location[0], + room: location[1] ?? '', + } + : undefined, } satisfies Serialized); } catch (e) { throw new Error(`Failed to parse schedule: ${dayLine} ${timeLine} ${locLine}`);