diff --git a/app/controllers/ReviewDocumentsController.scala b/app/controllers/ReviewDocumentsController.scala index 28a8109a5..7cce8be64 100644 --- a/app/controllers/ReviewDocumentsController.scala +++ b/app/controllers/ReviewDocumentsController.scala @@ -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: diff --git a/ui/src/app/enrolment/enrolment.service.ts b/ui/src/app/enrolment/enrolment.service.ts index cd3c9ddb7..0c9043ff7 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 = '?filter=' + (searchTerm?.length > 0 ? encodeURIComponent(searchTerm) : ''); const path = `/app/iop/enrolment${paramStr}`; return this.http.get(path); }; diff --git a/ui/src/app/exam/collaborative/collaborative-exam-listing.component.ts b/ui/src/app/exam/collaborative/collaborative-exam-listing.component.ts index b3fbf895a..f59b804e8 100644 --- a/ui/src/app/exam/collaborative/collaborative-exam-listing.component.ts +++ b/ui/src/app/exam/collaborative/collaborative-exam-listing.component.ts @@ -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), @@ -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) && @@ -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); }