refactor: doesn't crash tab, and doesn't cause errors (#143)

* refactor: doesn't crash tab, and doesn't cause errors

* Revert "fix: options page (#131)"

This reverts commit dc100b5d3a.

* refactor: Simplify CourseSchedule constructor

* refactor: Refactor CourseSchedule constructor (again)

* Reapply "fix: options page (#131)"

This reverts commit 969c5a234f.

---------

Co-authored-by: Razboy20 <razboy20@gmail.com>
This commit is contained in:
Som Gupta
2024-03-11 23:59:15 -05:00
committed by GitHub
parent a8ea3bc683
commit 7760e3acf4

View File

@@ -10,14 +10,12 @@ export class CourseSchedule {
meetings: CourseMeeting[] = [];
constructor(courseSchedule?: Serialized<CourseSchedule>) {
if (!courseSchedule) {
if (!courseSchedule || courseSchedule.meetings === undefined) {
this.meetings = [];
return;
}
Object.assign(this, courseSchedule);
this.meetings = [];
for (let meeting of courseSchedule.meetings) {
this.meetings.push(new CourseMeeting(meeting));
}
this.meetings = courseSchedule.meetings.map(meeting => new CourseMeeting(meeting));
}
/**