Skip to content

Commit

Permalink
Merge branch 'dev' into CSCEXAM-1283
Browse files Browse the repository at this point in the history
  • Loading branch information
lupari authored Jun 25, 2024
2 parents fa8f32e + a50def3 commit a4fe444
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 119 deletions.
3 changes: 2 additions & 1 deletion app/controllers/ReviewDocumentsController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ import scala.jdk.CollectionConverters.*
import scala.util.Using

class ReviewDocumentsController @Inject() (
val controllerComponents: ControllerComponents,
csvBuilder: CsvBuilder,
fileHandler: FileHandler,
authenticated: AuthenticatedAction,
implicit val ec: AuthExecutionContext
) extends InjectedController
) extends BaseController
with JavaApiHelper
with DbApiHelper
with Logging:
Expand Down
13 changes: 9 additions & 4 deletions ui/src/app/calendar/helpers/slot-picker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ <h2 class="calendar-phase-title">{{ sequenceNumber }}. {{ 'i18n_calendar_phase_2
</button>
<div ngbDropdownMenu role="menu" aria-labelledby="dropDownMenu1" class="xm-scrollable-menu">
@for (room of rooms(); track room.id) {
<button ngbDropdownItem role="presentation" (click)="selectRoom(room)" title="{{ room.name }}">
<div ngbDropdownItem [disabled]="room.outOfService" role="menuitem">
<a> {{ room.name }}</a>
</div>
<button
ngbDropdownItem
[class]="room.outOfService ? 'disabled' : ''"
role="menuitem"
(click)="selectRoom(room)"
title="{{ room.name }}"
[attr.aria-disabled]="room.outOfService"
>
<a> {{ room.name }}</a>
</button>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,101 +6,90 @@
<div ngbDropdownMenu>
<!-- enrolment with reservation, allow changing -->
@if (enrolment.reservation && canChangeReservation(enrolment.reservation)) {
<div ngbDropdownItem>
<!-- collaborative exam taken here -->
@if (enrolment.reservation.machine && enrolment.collaborativeExam) {
<a
class="btn btn-outline-secondary"
[routerLink]="['/calendar', enrolment.collaborativeExam.id, 'collaborative']"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
<!-- regular exam taken here -->
@if (enrolment.reservation.machine && !enrolment.collaborativeExam) {
<a class="btn btn-outline-secondary" [routerLink]="['/calendar', enrolment.exam.id]"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
<!-- regular exam taken elsewhere -->
@if (enrolment.reservation.externalReservation && enrolment.exam) {
<a class="btn btn-outline-secondary" [routerLink]="['/calendar', enrolment.exam.id, 'external']"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
<!-- collaborative exam taken elsewhere -->
@if (enrolment.reservation.externalReservation && enrolment.collaborativeExam) {
<a
class="btn btn-outline-secondary"
[routerLink]="['/calendar', enrolment.collaborativeExam.id, 'external']"
[queryParams]="{ isCollaborative: true }"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
</div>
<!-- collaborative exam taken here -->
@if (enrolment.reservation.machine && enrolment.collaborativeExam) {
<a
ngbDropdownItem
class="btn btn-outline-secondary"
[routerLink]="['/calendar', enrolment.collaborativeExam.id, 'collaborative']"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
<!-- regular exam taken here -->
@if (enrolment.reservation.machine && !enrolment.collaborativeExam) {
<a ngbDropdownItem class="btn btn-outline-secondary" [routerLink]="['/calendar', enrolment.exam.id]"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
<!-- regular exam taken elsewhere -->
@if (enrolment.reservation.externalReservation && enrolment.exam) {
<a
ngbDropdownItem
class="btn btn-outline-secondary"
[routerLink]="['/calendar', enrolment.exam.id, 'external']"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
<!-- collaborative exam taken elsewhere -->
@if (enrolment.reservation.externalReservation && enrolment.collaborativeExam) {
<a
ngbDropdownItem
class="btn btn-outline-secondary"
[routerLink]="['/calendar', enrolment.collaborativeExam.id, 'external']"
[queryParams]="{ isCollaborative: true }"
>{{ 'i18n_student_change_reservation' | translate }}
</a>
}
}
<!-- enrolment with examination event, allow changing -->
@if (enrolment.examinationEventConfiguration && hasUpcomingAlternativeEvents()) {
<div ngbDropdownItem>
<button class="btn btn-outline-secondary" (click)="makeReservation()">
{{ 'i18n_student_change_reservation' | translate }}
</button>
</div>
<button ngbDropdownItem class="btn btn-outline-secondary" (click)="makeReservation()">
{{ 'i18n_student_change_reservation' | translate }}
</button>
}
<!-- enrolment with reservation, allow reservation removal -->
@if (enrolment.reservation && canChangeReservation(enrolment.reservation)) {
<div ngbDropdownItem>
<button class="btn btn-outline-danger" (click)="removeReservation()">
{{ 'i18n_student_remove_reservation' | translate }}
</button>
</div>
<button ngbDropdownItem class="btn btn-outline-danger" (click)="removeReservation()">
{{ 'i18n_student_remove_reservation' | translate }}
</button>
}
<!-- reservation in progress, inform with a disabled item -->
@if (enrolment.reservation && !canChangeReservation(enrolment.reservation)) {
<div>
<button class="btn btn-outline-danger" [disabled]="true" (click)="removeReservation()">
{{ 'i18n_not_allowed_to_modify_reservation' | translate }}
</button>
</div>
<button ngbDropdownItem class="btn btn-outline-danger" [disabled]="true" (click)="removeReservation()">
{{ 'i18n_not_allowed_to_modify_reservation' | translate }}
</button>
}
<!-- enrolment with examination event, allow event removal -->
@if (enrolment.examinationEventConfiguration) {
<div ngbDropdownItem>
<button class="btn btn-outline-danger" (click)="removeReservation()">
{{ 'i18n_student_remove_reservation' | translate }}
</button>
</div>
<button ngbDropdownItem class="btn btn-outline-danger" (click)="removeReservation()">
{{ 'i18n_student_remove_reservation' | translate }}
</button>
}
<!-- enrolment without reservation or examination event, allow unenrolling (if other conditions pass) -->
@if (
!enrolment.reservation &&
!enrolment.examinationEventConfiguration &&
(enrolment.exam?.executionType?.type === 'PUBLIC' || enrolment.collaborativeExam)
) {
<div ngbDropdownItem>
<button (click)="removeEnrolment()" class="btn btn-outline-danger">
{{ 'i18n_student_remove_enrolment' | translate }}
</button>
</div>
<button ngbDropdownItem (click)="removeEnrolment()" class="btn btn-outline-danger">
{{ 'i18n_student_remove_enrolment' | translate }}
</button>
}
<!-- enrolment without reservation, allow making reservation -->
@if ((!enrolment.reservation && enrolment.exam?.implementation === 'AQUARIUM') || enrolment.collaborativeExam) {
<div ngbDropdownItem>
<button (click)="makeReservation()" class="btn btn-outline-secondary">
{{ 'i18n_student_new_reservation' | translate }}
</button>
</div>
<button ngbDropdownItem (click)="makeReservation()" class="btn btn-outline-secondary">
{{ 'i18n_student_new_reservation' | translate }}
</button>
}
<!-- enrolment without examination event, allow making reservation -->
@if (
!enrolment.examinationEventConfiguration &&
enrolment.exam?.implementation !== 'AQUARIUM' &&
hasUpcomingAlternativeEvents()
) {
<div ngbDropdownItem>
<button class="btn btn-outline-secondary" (click)="makeReservation()">
{{ 'i18n_student_new_reservation' | translate }}
</button>
</div>
<button ngbDropdownItem class="btn btn-outline-secondary" (click)="makeReservation()">
{{ 'i18n_student_new_reservation' | translate }}
</button>
}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class CollaborativeParticipationsComponent implements OnInit, AfterViewIn
pageSize = 10;
currentPage = 0;
filter = { ordering: 'ended', reverse: true, text: '' };
searchDone = false;

constructor(
private changeDetector: ChangeDetectorRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@
<div class="input-group-append search">
<img alt="" src="/assets/images/icon_search.png" width="49" height="40" />
</div>
<div class="invisible">{{ participations.length > 0 ? '' : '' }}</div>
</div>
</div>
@if (searchDone) {
<div class="row my-2">
<div class="col-12" aria-live="polite">
{{ 'i18n_student_exam_search_result' | translate }} {{ participations.length }}
{{ 'i18n_student_exam_search_result_continues' | translate }}
</div>
</div>
}
<div class="col-8" ngbDropdown>
<button class="btn btn-outline-secondary" type="button" ngbDropdownToggle aria-expanded="true">
{{ 'i18n_set_ordering' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class ExamParticipationsComponent implements OnInit, OnDestroy {
collaborative = false;
filterChanged: Subject<string> = new Subject<string>();
ngUnsubscribe = new Subject();
searchDone = false;

constructor(
private toast: ToastrService,
Expand Down Expand Up @@ -91,6 +92,7 @@ export class ExamParticipationsComponent implements OnInit, OnDestroy {
(p) => (p.ended = p.reservation ? p.reservation.endAt : p.started),
);
this.participations = data.filter((d) => d.ended);
this.searchDone = true;
},
error: (err) => this.toast.error(err),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ import { ExamSearchResultComponent } from './exam-search-result.component';
</div>
</div>
</div>
@if (exams.length > 0 && filter.text.length > 2) {
@if (searchDone) {
<div class="row mt-2">
<div class="col-12">
<div class="col-12" aria-live="polite">
{{ 'i18n_student_exam_search_result' | translate }} {{ exams.length }}
{{ 'i18n_student_exam_search_result_continues' | translate }}
<b>"{{ filter.text }}"</b>
</div>
</div>
}
Expand Down Expand Up @@ -95,6 +93,7 @@ export class CollaborativeExamSearchComponent implements OnInit, OnDestroy {
loader = { loading: false };
filterChanged: Subject<string> = new Subject<string>();
ngUnsubscribe = new Subject();
searchDone = false;

constructor(private Enrolment: EnrolmentService) {
this.filterChanged
Expand Down Expand Up @@ -140,7 +139,7 @@ export class CollaborativeExamSearchComponent implements OnInit, OnDestroy {
if (text.length > 2) {
this.filter.text = text;
this.loader = { loading: true };

this.searchDone = true;
this.Enrolment.searchExams$(text)
.pipe(
tap((exams) => this.updateExamList(exams)),
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/enrolment/search/exam-search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ import { ExamSearchService } from './exam-search.service';
</div>
</div>
}
@if (exams.length > 0) {
@if (searchDone) {
<div class="row my-2">
<div class="col-md-12">
<div class="col-12" aria-live="polite">
{{ 'i18n_student_exam_search_result' | translate }} {{ exams.length }}
{{ 'i18n_student_exam_search_result_continues' | translate }}
<b>"{{ filter.text }}"</b>
</div>
</div>
}
Expand Down Expand Up @@ -116,6 +114,7 @@ export class ExamSearchComponent implements OnInit, OnDestroy {
ngUnsubscribe = new Subject();
filter = { text: '' };
permissionCheck = { active: false };
searchDone = false;

constructor(
private toast: ToastrService,
Expand Down Expand Up @@ -163,6 +162,7 @@ export class ExamSearchComponent implements OnInit, OnDestroy {
});
this.exams = exams;
this.checkEnrolment();
this.searchDone = true;
},
error: (err) => this.toast.error(err),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class CollaborativeExamListingComponent implements OnInit, OnDestroy {
distinctUntilChanged(),
switchMap((text) => this.CollaborativeExam.searchExams$(text)),
tap(() => (this.loader.loading = true)),
map((exams) => this.returnListedCollaborativeExams(exams)),
map((exams) => this.searchExams(exams)),
tap((exams) => (this.exams = exams)),
tap(() => (this.loader.loading = false)),
takeUntil(this.ngUnsubscribe),
Expand All @@ -120,20 +120,6 @@ export class CollaborativeExamListingComponent implements OnInit, OnDestroy {

listAllExams = () => this.filterChanged.next('');

returnListedCollaborativeExams(exams: CollaborativeExam[]): ListedCollaborativeExam[] {
const listedExams: ListedCollaborativeExam[] = exams
.map((e) => {
const ownerAggregate = e.examOwners.map((o) => o.email).join();
const stateTranslation = this.getStateTranslation(e);
const listingView = this.determineListingView(e);

return { ...e, ownerAggregate, stateTranslation, listingView };
})
.filter((e) => e.listingView !== ListingView.OTHER);

return listedExams;
}

determineListingView(exam: CollaborativeExam) {
if (
(exam.state === CollaborativeExamState.PUBLISHED || exam.state === CollaborativeExamState.PRE_PUBLISHED) &&
Expand Down Expand Up @@ -181,4 +167,15 @@ export class CollaborativeExamListingComponent implements OnInit, OnDestroy {
const e = event.target as HTMLInputElement;
return this.filterChanged.next(e.value);
};

private searchExams = (exams: CollaborativeExam[]): ListedCollaborativeExam[] =>
exams
.map((e) => {
const ownerAggregate = e.examOwners.map((o) => o.email).join();
const stateTranslation = this.getStateTranslation(e);
const listingView = this.determineListingView(e);

return { ...e, ownerAggregate, stateTranslation, listingView };
})
.filter((e) => e.listingView !== ListingView.OTHER);
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export class ExamPublicationComponent implements OnInit {
error: (err) => this.toast.error(err),
});
},
error: (err) => this.toast.error(err),
});
}
};
Expand Down
10 changes: 9 additions & 1 deletion ui/src/app/review/listing/categories/in-progress.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
(click)="setPredicate('examParticipation.deadline')"
></xm-table-sort>
</th>
<th class="with-space with-top">{{ 'i18n_inspection_status' | translate }}</th>
<th class="with-space with-top">{{ 'i18n_grading_inspector' | translate }}</th>
<th class="with-space with-top">{{ 'i18n_exam_state' | translate }}</th>
</tr>
</thead>
Expand Down Expand Up @@ -188,6 +188,14 @@
<span [ngClass]="isOwner(inspection.user) ? 'fw-bold' : ''">
{{ inspection.user.firstName }} {{ inspection.user.lastName }}
</span>
<span>
@if (inspection.ready) {
<span>({{ 'i18n_ready' | translate }})</span>
}
@if (!inspection.ready) {
<span>({{ 'i18n_in_progress' | translate }})</span>
}
</span>
</span>
}
}
Expand Down
10 changes: 9 additions & 1 deletion ui/src/app/review/listing/speed-review.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
(click)="setPredicate('examParticipation.deadline')"
></xm-table-sort>
</th>
<th class="with-space">{{ 'i18n_inspection_status' | translate }}</th>
<th class="with-space">{{ 'i18n_grading_inspector' | translate }}</th>
<th class="with-space">{{ 'i18n_exam_state' | translate }}</th>
<th class="with-space with-top">{{ 'i18n_total_score' | translate }}</th>
<th class="with-top">{{ 'i18n_grade' | translate }}</th>
Expand Down Expand Up @@ -108,6 +108,14 @@
>
{{ inspection.user.firstName }} {{ inspection.user.lastName }}
</span>
<span>
@if (inspection.ready) {
<span>({{ 'i18n_ready' | translate }})</span>
}
@if (!inspection.ready) {
<span>({{ 'i18n_in_progress' | translate }})</span>
}
</span>
</span>
</div>
}
Expand Down
Loading

0 comments on commit a4fe444

Please sign in to comment.