From fa8f32e5acb6cc894be8c476a8a99bee4af77c52 Mon Sep 17 00:00:00 2001 From: Matti Lupari Date: Tue, 18 Jun 2024 19:52:25 +0300 Subject: [PATCH] CSCEXAM-1283 Collab exam search with no filter - Fix query parameter handling so that results are not limited to 100 --- .../collaboration/impl/CollaborativeExamController.java | 2 +- app/system/actors/ReservationPollerActor.scala | 7 ++++--- ui/src/app/enrolment/enrolment.service.ts | 2 +- .../app/exam/collaborative/collaborative-exam.service.ts | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/iop/collaboration/impl/CollaborativeExamController.java b/app/controllers/iop/collaboration/impl/CollaborativeExamController.java index ca183ad41..6e198d63f 100644 --- a/app/controllers/iop/collaboration/impl/CollaborativeExamController.java +++ b/app/controllers/iop/collaboration/impl/CollaborativeExamController.java @@ -100,7 +100,7 @@ private Exam prepareDraft(User user) { @Authenticated @Restrict({ @Group("ADMIN"), @Group("TEACHER") }) - public CompletionStage searchExams(Http.Request request, final Optional filter) { + public CompletionStage searchExams(Http.Request request, Optional filter) { WSRequest wsRequest = getSearchRequest(filter); User user = request.attrs().get(Attrs.AUTHENTICATED_USER); String homeOrg = configReader.getHomeOrganisationRef(); diff --git a/app/system/actors/ReservationPollerActor.scala b/app/system/actors/ReservationPollerActor.scala index 21c07f50e..13c188ddc 100644 --- a/app/system/actors/ReservationPollerActor.scala +++ b/app/system/actors/ReservationPollerActor.scala @@ -39,13 +39,13 @@ class ReservationPollerActor @Inject ( with DbApiHelper: private def isPast(ee: ExamEnrolment): Boolean = - val now = dateTimeHandler.adjustDST(DateTime.now) if (ee.getExaminationEventConfiguration == null && ee.getReservation != null) - return ee.getReservation.getEndAt.isBefore(now) + val now = dateTimeHandler.adjustDST(DateTime.now) + ee.getReservation.getEndAt.isBefore(now) else if (ee.getExaminationEventConfiguration != null) { val duration = ee.getExam.getDuration val start = ee.getExaminationEventConfiguration.getExaminationEvent.getStart - return start.plusMinutes(duration).isBefore(now) + start.plusMinutes(duration).isBeforeNow } false @@ -79,6 +79,7 @@ class ReservationPollerActor @Inject ( .eq("sentAsNoShow", false) .lt("endAt", dateTimeHandler.adjustDST(DateTime.now)) .list + if enrolments.isEmpty && reservations.isEmpty then logger.debug("None found") else noShowHandler.handleNoShows(enrolments.asJava, reservations.asJava) logger.debug("<- done") diff --git a/ui/src/app/enrolment/enrolment.service.ts b/ui/src/app/enrolment/enrolment.service.ts index cd3c9ddb7..9ff871001 100644 --- a/ui/src/app/enrolment/enrolment.service.ts +++ b/ui/src/app/enrolment/enrolment.service.ts @@ -188,7 +188,7 @@ export class EnrolmentService { this.http.get('/app/iop/student/finishedExams'); searchExams$ = (searchTerm: string): Observable => { - const paramStr = '?filter=' + (searchTerm && searchTerm.length > 0 ? encodeURIComponent(searchTerm) : ''); + const paramStr = searchTerm ? `?filter=${encodeURIComponent(searchTerm)}` : ''; const path = `/app/iop/enrolment${paramStr}`; return this.http.get(path); }; diff --git a/ui/src/app/exam/collaborative/collaborative-exam.service.ts b/ui/src/app/exam/collaborative/collaborative-exam.service.ts index e84c19595..5582c017b 100644 --- a/ui/src/app/exam/collaborative/collaborative-exam.service.ts +++ b/ui/src/app/exam/collaborative/collaborative-exam.service.ts @@ -44,7 +44,7 @@ export class CollaborativeExamService { createExam$ = (): Observable => this.http.post('/app/iop/exams', {}); searchExams$ = (searchTerm: string): Observable => { - const paramStr = '?filter=' + (searchTerm && searchTerm.length > 0 ? encodeURIComponent(searchTerm) : ''); + const paramStr = searchTerm ? `?filter=${encodeURIComponent(searchTerm)}` : ''; const path = `/app/iop/exams${paramStr}`; return this.http.get(path); };