diff --git a/app/models/enrolment/ExamEnrolment.java b/app/models/enrolment/ExamEnrolment.java index 5c612af20..96805a626 100644 --- a/app/models/enrolment/ExamEnrolment.java +++ b/app/models/enrolment/ExamEnrolment.java @@ -33,7 +33,7 @@ @Entity public class ExamEnrolment extends GeneratedIdentityModel implements Comparable { - private static final int DELAY_MAX = 30; + private static final int DELAY_MAX = 30 * 1000; @ManyToOne @JsonManagedReference diff --git a/app/repository/EnrolmentRepository.java b/app/repository/EnrolmentRepository.java index 49c93d7a9..15d71f4c2 100644 --- a/app/repository/EnrolmentRepository.java +++ b/app/repository/EnrolmentRepository.java @@ -288,11 +288,6 @@ private void handleUpcomingEnrolment( if ( enrolment.getExam() != null && enrolment.getExam().getImplementation() == Exam.Implementation.AQUARIUM ) { - // If user is on a correct aquarium machine then always set a header - headers.put( - "x-exam-aquarium-login", - String.format("%s:::%d", getExamHash(enrolment), enrolment.getId()) - ); // Aquarium exam, don't set headers unless it starts in 5 minutes DateTime threshold = DateTime.now().plusMinutes(5); DateTime start = dateTimeHandler.normalize( @@ -327,22 +322,22 @@ private boolean isInsideBounds(ExamEnrolment ee, int minutesToFuture) { int delay = ee.getDelay(); return ( (reservation != null && - reservation.getStartAt().plusSeconds(delay).isBefore(latest) && + reservation.getStartAt().plusMillis(delay).isBefore(latest) && reservation.getEndAt().isAfter(earliest)) || (event != null && - event.getStart().plusSeconds(delay).isBefore(latest) && + event.getStart().plusMillis(delay).isBefore(latest) && event.getStart().plusMinutes(ee.getExam().getDuration()).isAfter(earliest)) ); } private DateTime getStartTime(ExamEnrolment enrolment) { return enrolment.getReservation() != null - ? enrolment.getReservation().getStartAt().plusSeconds(enrolment.getDelay()) + ? enrolment.getReservation().getStartAt().plusMillis(enrolment.getDelay()) : enrolment .getExaminationEventConfiguration() .getExaminationEvent() .getStart() - .plusSeconds(enrolment.getDelay()); + .plusMillis(enrolment.getDelay()); } private Optional getNextEnrolment(Long userId, int minutesToFuture) { diff --git a/conf/evolutions/default/136.sql b/conf/evolutions/default/136.sql new file mode 100644 index 000000000..b8340b118 --- /dev/null +++ b/conf/evolutions/default/136.sql @@ -0,0 +1,9 @@ +-- SPDX-FileCopyrightText: 2024 The members of the EXAM Consortium +-- +-- SPDX-License-Identifier: EUPL-1.2 + +# --- !Ups +UPDATE exam_enrolment SET delay = delay * 1000; + +# --- !Downs +UPDATE exam_enrolment SET delay = delay / 1000; diff --git a/ui/src/app/enrolment/waiting-room/waiting-room.component.ts b/ui/src/app/enrolment/waiting-room/waiting-room.component.ts index ebb2baa69..9f2175752 100644 --- a/ui/src/app/enrolment/waiting-room/waiting-room.component.ts +++ b/ui/src/app/enrolment/waiting-room/waiting-room.component.ts @@ -102,7 +102,7 @@ export class WaitingRoomComponent implements OnInit, OnDestroy { private startScheduled = () => { window.clearTimeout(this.startTimerId); const offset = Math.ceil( - DateTime.fromJSDate(this.getStart()).plus({ seconds: this.enrolment.delay }).toSeconds() - + DateTime.fromJSDate(this.getStart()).plus({ milliseconds: this.enrolment.delay }).toSeconds() - DateTime.now().toSeconds(), ); this.delayTimerId = window.setTimeout(this.Session.checkSession, Math.max(0, offset * 1000));