diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2022-08-16 13:33:08 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2022-08-16 13:33:08 -0500 |
| commit | c693728191f572d059ca0bbfceb40a1f2c8bdfc1 (patch) | |
| tree | 3560135a2ba0d8f8d667340eb09501dd6f06cd34 /src/models/PeerTeacher.ts | |
| parent | 9beca9162322656d063398993967a418eef3e700 (diff) | |
`fix`: Handle adding NaN to number
Diffstat (limited to 'src/models/PeerTeacher.ts')
| -rw-r--r-- | src/models/PeerTeacher.ts | 5 |
1 files changed, 2 insertions, 3 deletions
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; } |
