From c693728191f572d059ca0bbfceb40a1f2c8bdfc1 Mon Sep 17 00:00:00 2001 From: Furkan Sahin Date: Tue, 16 Aug 2022 13:33:08 -0500 Subject: `fix`: Handle adding NaN to number --- src/models/PeerTeacher.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/models/PeerTeacher.ts b/src/models/PeerTeacher.ts index eae1984..3ba5c79 100644 --- a/src/models/PeerTeacher.ts +++ b/src/models/PeerTeacher.ts @@ -79,7 +79,7 @@ export default class PeerTeacher { pt.new_ret = qt.new_ret; pt.prof_pic_url = qt.prof_pic_url; pt.schedule_url = qt.schedule_url; - pt.office_hours = office_hours.map(e => EventInfo.fromJSON(e)); + pt.office_hours = office_hours?.map(e => EventInfo.fromJSON(e)); return pt; } @@ -103,9 +103,8 @@ export default class PeerTeacher { let total_hours = 0; this.labs.forEach((lab_id) => { - total_hours += all_labs.get(lab_id)?.pay_hours; + total_hours += all_labs?.get(lab_id)?.pay_hours ?? 0; }) - return total_hours; } -- cgit v1.2.3