aboutsummaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/models')
-rw-r--r--src/models/PeerTeacher.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/models/PeerTeacher.ts b/src/models/PeerTeacher.ts
index 3ba5c79..4cb36dd 100644
--- a/src/models/PeerTeacher.ts
+++ b/src/models/PeerTeacher.ts
@@ -120,4 +120,30 @@ export default class PeerTeacher {
return `${this?.phone_number.substring(0, 3)}-${this?.phone_number.substring(3, 6)}-${this?.phone_number.substring(6, 10)}`;
}
+ get office_hours_hours(): number {
+ let hours = 0;
+ this.office_hours.forEach((e) => {
+ hours += e.duration_mins / 60;
+ })
+ return hours;
+ }
+
+ coursesAndLabs() {
+ const courses = new Map<number, number[]>();
+ const getCourse = (x: number) => Math.floor(x / 1000);
+ this.labs.forEach((lab_id) => {
+ const key = getCourse(lab_id);
+ const sec = lab_id % 1000;
+ if (courses.has(key)) {
+ courses.get(key).push(sec);
+ } else {
+ courses.set(key, [sec]);
+ }
+ });
+ this.can_teach.forEach((course) => {
+ if (course == null || course == undefined) return;
+ if (!courses.has(course)) courses.set(course, []);
+ });
+ return courses;
+ }
} \ No newline at end of file