This commit is contained in:
Casey Charleston
2024-02-17 17:59:05 -06:00
parent 724e1a1d19
commit 6883a0bc8d
7 changed files with 515 additions and 354 deletions

View File

@@ -7,13 +7,18 @@ import { Course } from './Course';
export class UserSchedule {
courses: Course[];
name: string;
hours: number;
constructor(schedule: Serialized<UserSchedule>) {
this.courses = schedule.courses.map(c => new Course(c));
this.name = schedule.name;
this.hours = 0;
for (const course of this.courses) {
this.hours += course.creditHours;
}
}
containsCourse(course: Course): boolean {
return this.courses.some(c => c.uniqueId === course.uniqueId);
}
}
}