Skip to content

Commit

Permalink
CSCEXAM-1283 Collab exam search with no filter
Browse files Browse the repository at this point in the history
- Fix query parameter handling so that results are not limited to 100
  • Loading branch information
lupari committed Jun 25, 2024
1 parent 0862806 commit fa8f32e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private Exam prepareDraft(User user) {

@Authenticated
@Restrict({ @Group("ADMIN"), @Group("TEACHER") })
public CompletionStage<Result> searchExams(Http.Request request, final Optional<String> filter) {
public CompletionStage<Result> searchExams(Http.Request request, Optional<String> filter) {
WSRequest wsRequest = getSearchRequest(filter);
User user = request.attrs().get(Attrs.AUTHENTICATED_USER);
String homeOrg = configReader.getHomeOrganisationRef();
Expand Down
7 changes: 4 additions & 3 deletions app/system/actors/ReservationPollerActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/enrolment/enrolment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class EnrolmentService {
this.http.get<CollaborativeParticipation[]>('/app/iop/student/finishedExams');

searchExams$ = (searchTerm: string): Observable<CollaborativeExam[]> => {
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<CollaborativeExam[]>(path);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class CollaborativeExamService {
createExam$ = (): Observable<CollaborativeExam> => this.http.post<CollaborativeExam>('/app/iop/exams', {});

searchExams$ = (searchTerm: string): Observable<CollaborativeExam[]> => {
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<CollaborativeExam[]>(path);
};
Expand Down

0 comments on commit fa8f32e

Please sign in to comment.