Skip to content

Commit

Permalink
Exam mode: Fix test exam working time starting too early (#6222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strohgelaender authored Feb 9, 2023
1 parent 7b59b19 commit aa7a5c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ export class ExamParticipationComponent implements OnInit, OnDestroy, ComponentC
this.studentExam.exam!.course.id = this.courseId;
this.exam = studentExam.exam!;
this.testExam = this.exam.testExam!;
this.testStartTime = dayjs();
this.initIndividualEndDates(this.testStartTime);
this.loadingExam = false;
},
error: () => (this.loadingExam = false),
Expand All @@ -189,11 +187,7 @@ export class ExamParticipationComponent implements OnInit, OnDestroy, ComponentC
this.studentExam = studentExam;
this.exam = studentExam.exam!;
this.testExam = this.exam.testExam!;
if (this.exam.testExam) {
// For TestExams, we either set the StartTime to the current time or the startedDate of the studentExam, if existent
this.testStartTime = this.studentExam.startedDate ? this.studentExam.startedDate! : dayjs();
this.initIndividualEndDates(this.testStartTime);
} else {
if (!this.exam.testExam) {
this.initIndividualEndDates(this.exam.startDate!);
}

Expand Down Expand Up @@ -310,7 +304,9 @@ export class ExamParticipationComponent implements OnInit, OnDestroy, ComponentC
this.examParticipationService.setExamExerciseIds(exerciseIds);
// set endDate with workingTime
if (!!this.testRunId || this.testExam) {
this.individualStudentEndDate = this.testStartTime!.add(this.studentExam.workingTime!, 'seconds');
this.testStartTime = studentExam.startedDate ? dayjs(studentExam.startedDate) : dayjs();
this.initIndividualEndDates(this.testStartTime);
this.individualStudentEndDate = this.testStartTime.add(this.studentExam.workingTime!, 'seconds');
} else {
this.individualStudentEndDate = dayjs(this.exam.startDate).add(this.studentExam.workingTime!, 'seconds');
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/overview/course-overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Course } from 'app/entities/course.model';
import { MetisConversationService } from 'app/shared/metis/metis-conversation.service';
import { CourseManagementService } from '../course/manage/course-management.service';
import { ActivatedRoute } from '@angular/router';
import { Subject, Subscription, forkJoin, take, takeUntil } from 'rxjs';
import { Subject, Subscription, forkJoin, takeUntil } from 'rxjs';
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { CourseScoreCalculationService } from 'app/overview/course-score-calculation.service';
import { TeamService } from 'app/exercises/shared/team/team.service';
Expand Down

0 comments on commit aa7a5c7

Please sign in to comment.