Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aplr committed Oct 14, 2023
1 parent 1eeb5de commit 72205fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class ExamUpdateComponent implements OnInit, OnDestroy {
updateExamWorkingTime() {
if (this.exam.testExam) return;

this.exam.workingTime = examWorkingTime(this.exam);
this.exam.workingTime = examWorkingTime(this.exam) ?? 0;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/main/webapp/app/exam/participate/exam.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ export const endTime = (exam: Exam, studentExam: StudentExam): dayjs.Dayjs | und
};

/**
* Calculates the working time of the exam in seconds
* Calculates the working time of the exam in seconds.
* If either the exam or the exam dates are not set, undefined is returned.
*
* @param exam
* @return {number | undefined}
*/
export const examWorkingTime = (exam?: Exam): number | undefined => normalWorkingTime(exam?.startDate, exam?.endDate);

/**
* Calculates the time between start and end date in seconds
* Calculates the time between start and end date in seconds.
* If either the start or end date is not set, undefined is returned.
*
* @param startDate
* @param endDate
Expand Down

0 comments on commit 72205fc

Please sign in to comment.