diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 066bacf22..22d11e8c0 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -10,7 +10,7 @@ const routes: Routes = [ canActivate: [authGuard()], loadChildren: () => import('./presence-control/presence-control.module').then( - (m) => m.PresenceControlModule + (m) => m.PresenceControlModule, ), }, { @@ -18,7 +18,7 @@ const routes: Routes = [ canActivate: [authGuard()], loadChildren: () => import('./open-absences/open-absences.module').then( - (m) => m.OpenAbsencesModule + (m) => m.OpenAbsencesModule, ), }, { @@ -26,7 +26,7 @@ const routes: Routes = [ canActivate: [authGuard()], loadChildren: () => import('./edit-absences/edit-absences.module').then( - (m) => m.EditAbsencesModule + (m) => m.EditAbsencesModule, ), }, { @@ -34,7 +34,7 @@ const routes: Routes = [ canActivate: [authGuard()], loadChildren: () => import('./evaluate-absences/evaluate-absences.module').then( - (m) => m.EvaluateAbsencesModule + (m) => m.EvaluateAbsencesModule, ), }, { @@ -48,7 +48,7 @@ const routes: Routes = [ canActivate: [authGuard()], loadChildren: () => import('./person-search/person-search.module').then( - (module) => module.PersonSearchModule + (module) => module.PersonSearchModule, ), }, { @@ -56,7 +56,7 @@ const routes: Routes = [ canActivate: [authGuard()], loadChildren: () => import('./my-absences/my-absences.module').then( - (m) => m.MyAbsencesModule + (m) => m.MyAbsencesModule, ), }, { @@ -76,7 +76,7 @@ const routes: Routes = [ canActivate: [authGuard()], loadChildren: () => import('./my-settings/my-settings.module').then( - (m) => m.MySettingsModule + (m) => m.MySettingsModule, ), }, { path: 'unauthenticated', component: UnauthenticatedComponent }, diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 933e2d759..dd39007d7 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -11,7 +11,7 @@ describe('AppComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [AppComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a37315e02..9f6ca9ac2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -21,7 +21,7 @@ export class AppComponent { i18n: I18nService, private toastService: ToastService, @Inject(SETTINGS) private settings: Settings, - @Inject(NAVIGATOR) private navigator: Navigator + @Inject(NAVIGATOR) private navigator: Navigator, ) { this.router.initialNavigation(); i18n.initialize(); @@ -35,10 +35,10 @@ export class AppComponent { console.error(String(error)); this.toastService.error( 'Please check the contents of the settings.js file (see Console output for more details).', - 'Invalid Settings' + 'Invalid Settings', ); return EMPTY; - }) + }), ) .subscribe(); } diff --git a/src/app/edit-absences/components/edit-absences-edit/edit-absences-edit.component.ts b/src/app/edit-absences/components/edit-absences-edit/edit-absences-edit.component.ts index b32354e9d..0c471453f 100644 --- a/src/app/edit-absences/components/edit-absences-edit/edit-absences-edit.component.ts +++ b/src/app/edit-absences/components/edit-absences-edit/edit-absences-edit.component.ts @@ -58,12 +58,12 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { absenceTypeIdErrors$ = getValidationErrors( this.formGroup$, this.submitted$, - 'absenceTypeId' + 'absenceTypeId', ); incidentIdErrors$ = getValidationErrors( this.formGroup$, this.submitted$, - 'incidentId' + 'incidentId', ); availableCategories = [ @@ -83,8 +83,8 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { map((halfDayActive) => halfDayActive ? this.availableCategories - : this.availableCategories.filter((c) => c !== Category.HalfDay) - ) + : this.availableCategories.filter((c) => c !== Category.HalfDay), + ), ); private destroy$ = new Subject(); @@ -99,7 +99,7 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { private dropDownItemsService: DropDownItemsRestService, private presenceTypesService: PresenceTypesService, private updateService: EditAbsencesUpdateService, - @Inject(SETTINGS) private settings: Settings + @Inject(SETTINGS) private settings: Settings, ) {} ngOnInit(): void { @@ -160,9 +160,9 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { ], absenceTypeId: [initialAbsenceTypeId, Validators.required], incidentId: [{ value: null, disabled: true }, Validators.required], - }) + }), ), - shareReplay(1) + shareReplay(1), ); } @@ -172,14 +172,14 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { map((absenceTypes) => { const availableTypeIds = absenceTypes.map((t) => t.Id); const selectedTypeIds = uniq( - this.state.selected.map((e) => e.TypeRef.Id) + this.state.selected.map((e) => e.TypeRef.Id), ); return selectedTypeIds.length === 1 && selectedTypeIds[0] != null && availableTypeIds.includes(selectedTypeIds[0]) ? selectedTypeIds[0] : null; - }) + }), ); } @@ -237,10 +237,10 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { category, confirmationValue, absenceTypeId, - incidentId - ) + incidentId, + ), ), - finalize(() => this.saving$.next(false)) + finalize(() => this.saving$.next(false)), ) .subscribe(this.onSaveSuccess.bind(this)); } @@ -248,7 +248,7 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { private onSaveSuccess(): void { this.state.resetSelection(); this.toastService.success( - this.translate.instant('edit-absences.edit.save-success') + this.translate.instant('edit-absences.edit.save-success'), ); this.navigateBack(true); } @@ -265,7 +265,7 @@ export class EditAbsencesEditComponent implements OnInit, OnDestroy { } private sortAbsenceConfirmationStates( - states: ReadonlyArray + states: ReadonlyArray, ): ReadonlyArray { return states.slice().sort((a, b) => { if (a.Key === this.settings.excusedAbsenceStateId) { diff --git a/src/app/edit-absences/components/edit-absences-header/edit-absences-header.component.spec.ts b/src/app/edit-absences/components/edit-absences-header/edit-absences-header.component.spec.ts index 3789e4d0e..af83e55c1 100644 --- a/src/app/edit-absences/components/edit-absences-header/edit-absences-header.component.spec.ts +++ b/src/app/edit-absences/components/edit-absences-header/edit-absences-header.component.spec.ts @@ -24,7 +24,7 @@ describe('EditAbsencesHeaderComponent', () => { }, }, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.spec.ts b/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.spec.ts index bfd067a8f..389a3aff1 100644 --- a/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.spec.ts +++ b/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.spec.ts @@ -34,7 +34,7 @@ describe('EditAbsencesListComponent', () => { providers: [ { provide: EditAbsencesStateService, useValue: stateServiceMock }, ], - }) + }), ).compileComponents(); })); @@ -55,10 +55,10 @@ function buildPresenceControlEntry(): PresenceControlEntry { 5837_4508, new Date('2019-08-12T14:35:00'), new Date('2019-08-12T15:20:00'), - '2-1-Biologie-MNW-2019/20-22a' + '2-1-Biologie-MNW-2019/20-22a', ), null, - null + null, ); Object.defineProperty(presenceControlEntry, 'settings', { diff --git a/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.ts b/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.ts index d94b9863b..9307e43a6 100644 --- a/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.ts +++ b/src/app/edit-absences/components/edit-absences-list/edit-absences-list.component.ts @@ -37,7 +37,7 @@ export class EditAbsencesListComponent public state: EditAbsencesStateService, public selectionService: EditAbsencesSelectionService, private scrollPosition: ScrollPositionService, - private route: ActivatedRoute + private route: ActivatedRoute, ) {} ngOnInit(): void { @@ -61,7 +61,7 @@ export class EditAbsencesListComponent .pipe( take(1), map(({ reload }) => reload), - filter(isTruthy) + filter(isTruthy), ) .subscribe(() => this.state.resetEntries()); } @@ -78,7 +78,7 @@ export class EditAbsencesListComponent this.state.entries$ .pipe(take(1)) .subscribe((entries) => - this.selectionService.clear(checked ? entries : null) + this.selectionService.clear(checked ? entries : null), ); } diff --git a/src/app/edit-absences/components/edit-absences/edit-absences.component.spec.ts b/src/app/edit-absences/components/edit-absences/edit-absences.component.spec.ts index f54dd1a60..18519a6f9 100644 --- a/src/app/edit-absences/components/edit-absences/edit-absences.component.spec.ts +++ b/src/app/edit-absences/components/edit-absences/edit-absences.component.spec.ts @@ -17,7 +17,7 @@ describe('EditAbsencesComponent', () => { EditAbsencesHeaderComponent, EditAbsencesListComponent, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/edit-absences/services/edit-absences-state.service.spec.ts b/src/app/edit-absences/services/edit-absences-state.service.spec.ts index a02648962..9e4b55a49 100644 --- a/src/app/edit-absences/services/edit-absences-state.service.spec.ts +++ b/src/app/edit-absences/services/edit-absences-state.service.spec.ts @@ -6,13 +6,13 @@ import { buildTestModuleMetadata } from 'src/spec-helpers'; describe('EditAbsencesStateService', () => { beforeEach(() => TestBed.configureTestingModule( - buildTestModuleMetadata({ providers: [EditAbsencesStateService] }) - ) + buildTestModuleMetadata({ providers: [EditAbsencesStateService] }), + ), ); it('should be created', () => { const service: EditAbsencesStateService = TestBed.inject( - EditAbsencesStateService + EditAbsencesStateService, ); expect(service).toBeTruthy(); }); diff --git a/src/app/edit-absences/services/edit-absences-state.service.ts b/src/app/edit-absences/services/edit-absences-state.service.ts index 348d89338..17c2719d9 100644 --- a/src/app/edit-absences/services/edit-absences-state.service.ts +++ b/src/app/edit-absences/services/edit-absences-state.service.ts @@ -46,7 +46,7 @@ export class EditAbsencesStateService presenceTypes$ = this.loadPresenceTypes().pipe(shareReplay(1)); absenceConfirmationStates$ = this.loadAbsenceConfirmationStates().pipe( map(sortDropDownItemsByValue), - shareReplay(1) + shareReplay(1), ); presenceControlEntries$ = combineLatest([ @@ -64,14 +64,14 @@ export class EditAbsencesStateService @Inject(SETTINGS) settings: Settings, private lessonPresencesService: LessonPresencesRestService, private presenceTypesService: PresenceTypesService, - private dropDownItemsService: DropDownItemsRestService + private dropDownItemsService: DropDownItemsRestService, ) { super(location, loadingService, sortService, settings, '/edit-absences'); this.queryParamsString$ .pipe(takeUntil(this.destroy$)) .subscribe( - (returnparams) => (this.confirmBackLinkParams = { returnparams }) + (returnparams) => (this.confirmBackLinkParams = { returnparams }), ); } @@ -106,14 +106,14 @@ export class EditAbsencesStateService filterValue.dateTo || filterValue.presenceTypes || filterValue.confirmationStates || - filterValue.incidentTypes + filterValue.incidentTypes, ); } protected loadEntries( filterValue: EditAbsencesFilter, _sorting: null, - offset: number + offset: number, ): Observable>> { const params: Dict = { sort: 'StudentFullName.asc,LessonDateTimeFrom.asc', @@ -121,7 +121,7 @@ export class EditAbsencesStateService return this.loadingService.load( this.lessonPresencesService.getFilteredList(filterValue, offset, params), - PAGE_LOADING_CONTEXT + PAGE_LOADING_CONTEXT, ); } @@ -131,7 +131,7 @@ export class EditAbsencesStateService private loadPresenceTypes(): Observable> { return this.loadingService.load( - this.presenceTypesService.activePresenceTypes$ + this.presenceTypesService.activePresenceTypes$, ); } @@ -139,7 +139,7 @@ export class EditAbsencesStateService ReadonlyArray > { return this.loadingService.load( - this.dropDownItemsService.getAbsenceConfirmationStates() + this.dropDownItemsService.getAbsenceConfirmationStates(), ); } } diff --git a/src/app/edit-absences/services/edit-absences-update.service.ts b/src/app/edit-absences/services/edit-absences-update.service.ts index 63853f0a2..0c9bff2cb 100644 --- a/src/app/edit-absences/services/edit-absences-update.service.ts +++ b/src/app/edit-absences/services/edit-absences-update.service.ts @@ -23,7 +23,7 @@ export enum Category { export class EditAbsencesUpdateService { constructor( private updateService: LessonPresencesUpdateRestService, - @Inject(SETTINGS) private settings: Settings + @Inject(SETTINGS) private settings: Settings, ) {} update( @@ -32,7 +32,7 @@ export class EditAbsencesUpdateService { category: Category, confirmationValue: Option, absenceTypeId: Option, - incidentId: Option + incidentId: Option, ): Observable { let requests: ReadonlyArray> = []; switch (category) { @@ -44,21 +44,21 @@ export class EditAbsencesUpdateService { entries, presenceTypes, confirmationValue, - absenceTypeId + absenceTypeId, ); break; case Category.Dispensation: requests = this.createEditBulkRequests( entries, null, - this.settings.dispensationPresenceTypeId + this.settings.dispensationPresenceTypeId, ); break; case Category.HalfDay: requests = this.createEditBulkRequests( entries, null, - this.settings.halfDayPresenceTypeId + this.settings.halfDayPresenceTypeId, ); break; case Category.Incident: @@ -73,14 +73,14 @@ export class EditAbsencesUpdateService { entries: ReadonlyArray, presenceTypes: ReadonlyArray, confirmationValue: Option, - absenceTypeId: Option + absenceTypeId: Option, ): ReadonlyArray> { if (confirmationValue === this.settings.excusedAbsenceStateId) { // Update all entries to the absence type selected by the user return this.createEditBulkRequests( entries, confirmationValue, - absenceTypeId + absenceTypeId, ); } else if (confirmationValue === this.settings.unexcusedAbsenceStateId) { // Update all entries to the default absence type (possibly @@ -88,7 +88,7 @@ export class EditAbsencesUpdateService { return this.createEditBulkRequests( entries, confirmationValue, - this.settings.absencePresenceTypeId + this.settings.absencePresenceTypeId, ); } else { return [ @@ -97,47 +97,47 @@ export class EditAbsencesUpdateService { ...this.createEditBulkRequests( entries.filter(overrideAbsenceType(presenceTypes, this.settings)), confirmationValue, - this.settings.absencePresenceTypeId + this.settings.absencePresenceTypeId, ), // Keep the existing absence type for all other entries ...this.createEditBulkRequests( entries.filter( - not(overrideAbsenceType(presenceTypes, this.settings)) + not(overrideAbsenceType(presenceTypes, this.settings)), ), confirmationValue, - null + null, ), ]; } } private createResetBulkRequests( - entries: ReadonlyArray + entries: ReadonlyArray, ): ReadonlyArray> { return getIdsGroupedByPerson(entries).map(({ lessonIds, personIds }) => - this.updateService.removeLessonPresences(lessonIds, personIds) + this.updateService.removeLessonPresences(lessonIds, personIds), ); } private createEditBulkRequests( entries: ReadonlyArray, confirmationValue: Option, - absenceTypeId: Option + absenceTypeId: Option, ): ReadonlyArray> { return getIdsGroupedByPerson(entries).map(({ lessonIds, personIds }) => this.updateService.editLessonPresences( lessonIds, personIds, absenceTypeId || undefined, - confirmationValue || undefined - ) + confirmationValue || undefined, + ), ); } } function overrideAbsenceType( presenceTypes: ReadonlyArray, - settings: Settings + settings: Settings, ): (entry: LessonPresence) => boolean { return (entry) => { const presenceType = presenceTypes.find((t) => t.Id === entry.TypeRef.Id); diff --git a/src/app/evaluate-absences/components/evaluate-absences-header/evaluate-absences-header.component.spec.ts b/src/app/evaluate-absences/components/evaluate-absences-header/evaluate-absences-header.component.spec.ts index 60500ffac..189ff1fd5 100644 --- a/src/app/evaluate-absences/components/evaluate-absences-header/evaluate-absences-header.component.spec.ts +++ b/src/app/evaluate-absences/components/evaluate-absences-header/evaluate-absences-header.component.spec.ts @@ -13,7 +13,7 @@ describe('EvaluateAbsencesHeaderComponent', () => { buildTestModuleMetadata({ declarations: [EvaluateAbsencesHeaderComponent], providers: [EvaluateAbsencesStateService], - }) + }), ).compileComponents(); })); diff --git a/src/app/evaluate-absences/components/evaluate-absences-list/evaluate-absences-list.component.ts b/src/app/evaluate-absences/components/evaluate-absences-list/evaluate-absences-list.component.ts index 8612d9d6d..216374bdb 100644 --- a/src/app/evaluate-absences/components/evaluate-absences-list/evaluate-absences-list.component.ts +++ b/src/app/evaluate-absences/components/evaluate-absences-list/evaluate-absences-list.component.ts @@ -52,7 +52,7 @@ export class EvaluateAbsencesListComponent implements OnInit, AfterViewInit { private route: ActivatedRoute, private presenceTypesService: PresenceTypesService, private reportsService: ReportsService, - private lessonPresencesService: LessonPresencesRestService + private lessonPresencesService: LessonPresencesRestService, ) {} ngOnInit(): void { @@ -85,16 +85,16 @@ export class EvaluateAbsencesListComponent implements OnInit, AfterViewInit { map((lessonPresences) => lessonPresences.length > 0 ? this.reportsService.getEvaluateAbsencesUrl( - this.getReportRecordIds(lessonPresences) + this.getReportRecordIds(lessonPresences), ) - : null + : null, ), - shareReplay(1) + shareReplay(1), ); } private getReportRecordIds( - presences: ReadonlyArray + presences: ReadonlyArray, ): ReadonlyArray { return presences.map((p) => `${p.LessonRef.Id}_${p.RegistrationRef.Id}`); } diff --git a/src/app/evaluate-absences/components/evaluate-absences/evaluate-absences.component.spec.ts b/src/app/evaluate-absences/components/evaluate-absences/evaluate-absences.component.spec.ts index ec4b44284..96a603239 100644 --- a/src/app/evaluate-absences/components/evaluate-absences/evaluate-absences.component.spec.ts +++ b/src/app/evaluate-absences/components/evaluate-absences/evaluate-absences.component.spec.ts @@ -12,7 +12,7 @@ describe('EvaluateAbsencesComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ imports: [EvaluateAbsencesModule], - }) + }), ).compileComponents(); })); diff --git a/src/app/evaluate-absences/services/evaluate-absences-state.service.spec.ts b/src/app/evaluate-absences/services/evaluate-absences-state.service.spec.ts index dd38eb45d..9cbbed683 100644 --- a/src/app/evaluate-absences/services/evaluate-absences-state.service.spec.ts +++ b/src/app/evaluate-absences/services/evaluate-absences-state.service.spec.ts @@ -6,13 +6,13 @@ import { buildTestModuleMetadata } from 'src/spec-helpers'; describe('EvaluateAbsencesStateService', () => { beforeEach(() => TestBed.configureTestingModule( - buildTestModuleMetadata({ providers: [EvaluateAbsencesStateService] }) - ) + buildTestModuleMetadata({ providers: [EvaluateAbsencesStateService] }), + ), ); it('should be created', () => { const service: EvaluateAbsencesStateService = TestBed.inject( - EvaluateAbsencesStateService + EvaluateAbsencesStateService, ); expect(service).toBeTruthy(); }); diff --git a/src/app/evaluate-absences/services/evaluate-absences-state.service.ts b/src/app/evaluate-absences/services/evaluate-absences-state.service.ts index 04dfeced3..5893fc7f9 100644 --- a/src/app/evaluate-absences/services/evaluate-absences-state.service.ts +++ b/src/app/evaluate-absences/services/evaluate-absences-state.service.ts @@ -37,20 +37,20 @@ export class EvaluateAbsencesStateService loadingService: LoadingService, @Inject(SETTINGS) settings: Settings, private lessonPresenceService: LessonPresencesRestService, - sortService: SortService + sortService: SortService, ) { super( location, loadingService, sortService, settings, - '/evaluate-absences' + '/evaluate-absences', ); this.queryParamsString$ .pipe(takeUntil(this.destroy$)) .subscribe( - (returnparams) => (this.confirmBackLinkParams = { returnparams }) + (returnparams) => (this.confirmBackLinkParams = { returnparams }), ); } @@ -66,7 +66,7 @@ export class EvaluateAbsencesStateService return Boolean( filterValue.student || filterValue.educationalEvent || - filterValue.studyClass + filterValue.studyClass, ); } @@ -82,11 +82,11 @@ export class EvaluateAbsencesStateService protected loadEntries( filterValue: EvaluateAbsencesFilter, sorting: Option>, - offset: number + offset: number, ): Observable>> { return this.loadingService.load( this.lessonPresenceService.getStatistics(filterValue, sorting, offset), - PAGE_LOADING_CONTEXT + PAGE_LOADING_CONTEXT, ); } diff --git a/src/app/events/components/events-list/events-list.component.spec.ts b/src/app/events/components/events-list/events-list.component.spec.ts index 81b96a489..68396ec4f 100644 --- a/src/app/events/components/events-list/events-list.component.spec.ts +++ b/src/app/events/components/events-list/events-list.component.spec.ts @@ -22,7 +22,7 @@ describe('EventsListComponent', () => { providers: [ { provide: EventsStateService, useValue: stateServiceMock }, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/events/components/events/events.component.spec.ts b/src/app/events/components/events/events.component.spec.ts index 26055513c..4ff6ba281 100644 --- a/src/app/events/components/events/events.component.spec.ts +++ b/src/app/events/components/events/events.component.spec.ts @@ -11,7 +11,7 @@ describe('EventsComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [EventsComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/events/components/grade/grade.component.ts b/src/app/events/components/grade/grade.component.ts index e9fb4c3c7..3f9326659 100644 --- a/src/app/events/components/grade/grade.component.ts +++ b/src/app/events/components/grade/grade.component.ts @@ -47,11 +47,11 @@ export class GradeComponent implements OnInit, OnDestroy, OnChanges { points$: Observable = this.pointsSubject$.pipe( debounceTime(DEBOUNCE_TIME), - filter(this.isValid.bind(this)) + filter(this.isValid.bind(this)), ); grade$: Observable = this.gradeSubject$.pipe( - debounceTime(DEBOUNCE_TIME) + debounceTime(DEBOUNCE_TIME), ); destroy$ = new Subject(); @@ -65,14 +65,14 @@ export class GradeComponent implements OnInit, OnDestroy, OnChanges { this.points$ .pipe( takeUntil(this.destroy$), - map(this.buildRequestBodyPointsChange.bind(this)) + map(this.buildRequestBodyPointsChange.bind(this)), ) .subscribe((body) => this.gradeChanged.emit(body)); this.grade$ .pipe( takeUntil(this.destroy$), - map(this.buildRequestBodyForGradeChange.bind(this)) + map(this.buildRequestBodyForGradeChange.bind(this)), ) .subscribe((body) => this.gradeChanged.emit(body)); } @@ -101,7 +101,7 @@ export class GradeComponent implements OnInit, OnDestroy, OnChanges { } private buildRequestBodyPointsChange( - points: string | null + points: string | null, ): TestPointsResult { const newPoints = points === null || points === '' ? null : Number(points); return { diff --git a/src/app/events/components/grades/average-grades/average-grades.component.ts b/src/app/events/components/grades/average-grades/average-grades.component.ts index d276c7e08..e38269499 100644 --- a/src/app/events/components/grades/average-grades/average-grades.component.ts +++ b/src/app/events/components/grades/average-grades/average-grades.component.ts @@ -32,7 +32,7 @@ export class AverageGradesComponent { private safeAverage( test: Test, fractionDigits: number, - strategy: (test: Test) => number + strategy: (test: Test) => number, ): string { try { return ( diff --git a/src/app/events/components/grades/grade-select/grade-select.component.spec.ts b/src/app/events/components/grades/grade-select/grade-select.component.spec.ts index 1df3678a3..9a5ca3ca0 100644 --- a/src/app/events/components/grades/grade-select/grade-select.component.spec.ts +++ b/src/app/events/components/grades/grade-select/grade-select.component.spec.ts @@ -10,7 +10,7 @@ describe('GradeSelectComponent', () => { await TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [GradeSelectComponent], - }) + }), ).compileComponents(); }); diff --git a/src/app/events/components/test-edit-grades/test-edit-grades.component.spec.ts b/src/app/events/components/test-edit-grades/test-edit-grades.component.spec.ts index 16d6889b8..bde063451 100644 --- a/src/app/events/components/test-edit-grades/test-edit-grades.component.spec.ts +++ b/src/app/events/components/test-edit-grades/test-edit-grades.component.spec.ts @@ -36,7 +36,7 @@ describe('TestEditGradesComponent', () => { useValue: testStateServiceMock, }, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/events/components/test-edit-grades/test-edit-grades.component.ts b/src/app/events/components/test-edit-grades/test-edit-grades.component.ts index c8503f2a6..ddafaf529 100644 --- a/src/app/events/components/test-edit-grades/test-edit-grades.component.ts +++ b/src/app/events/components/test-edit-grades/test-edit-grades.component.ts @@ -27,7 +27,10 @@ import { Observable } from 'rxjs'; export class TestEditGradesComponent implements OnInit { @Input() selectedTest: Test | undefined; - constructor(public state: TestStateService, private modalService: NgbModal) {} + constructor( + public state: TestStateService, + private modalService: NgbModal, + ) {} ngOnInit(): void { // TODO move to sort implementation @@ -46,7 +49,7 @@ export class TestEditGradesComponent implements OnInit { this.state.course$ .pipe(take(1)) .subscribe((course) => - this.state.setAveragesAsFinalGrades({ CourseIds: [course.Id] }) + this.state.setAveragesAsFinalGrades({ CourseIds: [course.Id] }), ); } @@ -54,9 +57,9 @@ export class TestEditGradesComponent implements OnInit { return this.state.course$.pipe( map((course) => Boolean( - getEventState(course)?.value && studentGrade.finalGrade?.canGrade - ) - ) + getEventState(course)?.value && studentGrade.finalGrade?.canGrade, + ), + ), ); } @@ -107,7 +110,7 @@ export class TestEditGradesComponent implements OnInit { (result) => { if (result) action(); }, - () => {} + () => {}, ); } } diff --git a/src/app/events/components/test-table-header/test-table-header.component.spec.ts b/src/app/events/components/test-table-header/test-table-header.component.spec.ts index 7f6353fdc..0db1b14c9 100644 --- a/src/app/events/components/test-table-header/test-table-header.component.spec.ts +++ b/src/app/events/components/test-table-header/test-table-header.component.spec.ts @@ -12,7 +12,7 @@ describe('TestTableHeaderComponent', () => { await TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [TestTableHeaderComponent], - }) + }), ).compileComponents(); }); diff --git a/src/app/events/components/tests-edit-form/tests-edit-form.component.spec.ts b/src/app/events/components/tests-edit-form/tests-edit-form.component.spec.ts index a291dfa97..bab6bb61f 100644 --- a/src/app/events/components/tests-edit-form/tests-edit-form.component.spec.ts +++ b/src/app/events/components/tests-edit-form/tests-edit-form.component.spec.ts @@ -13,7 +13,7 @@ describe('TestsEditFormComponent', () => { buildTestModuleMetadata({ declarations: [TestsEditFormComponent], providers: [TestStateService], - }) + }), ).compileComponents(); }); diff --git a/src/app/events/components/tests-edit-form/tests-edit-form.component.ts b/src/app/events/components/tests-edit-form/tests-edit-form.component.ts index 27bfd302d..9b61c2d93 100644 --- a/src/app/events/components/tests-edit-form/tests-edit-form.component.ts +++ b/src/app/events/components/tests-edit-form/tests-edit-form.component.ts @@ -51,37 +51,37 @@ export class TestsEditFormComponent implements OnInit, OnDestroy { designationErrors$ = getValidationErrors( of(this.formGroup), this.submitted$, - 'designation' + 'designation', ); dateErrors$ = getValidationErrors( of(this.formGroup), this.submitted$, - 'date' + 'date', ); maxPointsErrors$ = getValidationErrors( of(this.formGroup), this.submitted$, - 'maxPoints' + 'maxPoints', ); maxPointsAdjustedErrors$ = getValidationErrors( of(this.formGroup), this.submitted$, - 'maxPointsAdjusted' + 'maxPointsAdjusted', ); weightErrors$ = getValidationErrors( of(this.formGroup), this.submitted$, - 'weight' + 'weight', ); constructor( private fb: UntypedFormBuilder, private translate: TranslateService, - private testStateService: TestStateService + private testStateService: TestStateService, ) {} courseId$ = this.testStateService.courseId$; diff --git a/src/app/events/components/tests-edit/tests-delete/tests-delete.component.spec.ts b/src/app/events/components/tests-edit/tests-delete/tests-delete.component.spec.ts index ffec95120..0298a7786 100644 --- a/src/app/events/components/tests-edit/tests-delete/tests-delete.component.spec.ts +++ b/src/app/events/components/tests-edit/tests-delete/tests-delete.component.spec.ts @@ -17,7 +17,7 @@ describe('TestsDeleteComponent', () => { buildTestModuleMetadata({ declarations: [TestsDeleteComponent], providers: [NgbActiveModal], - }) + }), ).compileComponents(); }); @@ -48,7 +48,7 @@ describe('TestsDeleteComponent', () => { expectMessage( debugElement, 'confirmation-message', - 'tests.form.delete-not-allowed' + 'tests.form.delete-not-allowed', ); expectMessage(debugElement, 'confirm-button', 'tests.dialog.ok'); @@ -60,9 +60,9 @@ describe('TestsDeleteComponent', () => { function expectMessage( debugElement: DebugElement, testId: string, - expectedMessage: string + expectedMessage: string, ) { expect( - debugElement.query(byTestId(testId)).nativeElement.textContent.trim() + debugElement.query(byTestId(testId)).nativeElement.textContent.trim(), ).toBe(expectedMessage); } diff --git a/src/app/events/components/tests-header/tests-header.component.spec.ts b/src/app/events/components/tests-header/tests-header.component.spec.ts index 101e946df..5e7633f4d 100644 --- a/src/app/events/components/tests-header/tests-header.component.spec.ts +++ b/src/app/events/components/tests-header/tests-header.component.spec.ts @@ -24,7 +24,7 @@ describe('TestsHeaderComponent', () => { buildTestModuleMetadata({ declarations: [TestsHeaderComponent], providers: [{ provide: ReportsService, useValue: reportsServiceMock }], - }) + }), ).compileComponents(); })); diff --git a/src/app/events/components/tests-header/tests-header.component.ts b/src/app/events/components/tests-header/tests-header.component.ts index a88af3056..805228706 100644 --- a/src/app/events/components/tests-header/tests-header.component.ts +++ b/src/app/events/components/tests-header/tests-header.component.ts @@ -14,7 +14,7 @@ export class TestsHeaderComponent { constructor( private reportsService: ReportsService, - private eventsRestService: EventsRestService + private eventsRestService: EventsRestService, ) {} loadReportUrl(): string { diff --git a/src/app/events/components/tests-list/tests-list.component.ts b/src/app/events/components/tests-list/tests-list.component.ts index 169e82a1e..96262155e 100644 --- a/src/app/events/components/tests-list/tests-list.component.ts +++ b/src/app/events/components/tests-list/tests-list.component.ts @@ -21,30 +21,30 @@ export class TestsListComponent { return { Key: test.Id, Value: test.Designation }; }), ]), - distinctUntilChanged() + distinctUntilChanged(), ); selectedTestId$ = merge( this.selectTest$, this.state.tests$.pipe( take(1), - map((tests) => tests[0]?.Id) - ) + map((tests) => tests[0]?.Id), + ), ).pipe(distinctUntilChanged()); selectedTest$: Observable = this.selectedTestId$.pipe( switchMap((id: number) => this.state.tests$.pipe( - map((tests) => tests.find((test) => test.Id === id)) - ) + map((tests) => tests.find((test) => test.Id === id)), + ), ), - distinctUntilChanged() + distinctUntilChanged(), ); constructor( @Inject(SETTINGS) public settings: Settings, public state: TestStateService, - private translate: TranslateService + private translate: TranslateService, ) {} testSelected(id: number) { @@ -54,7 +54,7 @@ export class TestsListComponent { buildLinkToRatingOverview() { return this.state.course$.pipe( take(1), - map((course) => `${this.settings.eventlist.evaluation}=${course.Id}`) + map((course) => `${this.settings.eventlist.evaluation}=${course.Id}`), ); } } diff --git a/src/app/events/components/tests-publish/publish-test.component.spec.ts b/src/app/events/components/tests-publish/publish-test.component.spec.ts index b9d48c78b..73f8c3a41 100644 --- a/src/app/events/components/tests-publish/publish-test.component.spec.ts +++ b/src/app/events/components/tests-publish/publish-test.component.spec.ts @@ -17,7 +17,7 @@ describe('PublishTestComponent', () => { buildTestModuleMetadata({ declarations: [PublishTestComponent], providers: [NgbActiveModal], - }) + }), ).compileComponents(); }); @@ -100,12 +100,12 @@ describe('PublishTestComponent', () => { function expectConfirmationMessage( debugElement: DebugElement, - expected: string + expected: string, ) { const confirmationMessageElement = debugElement.query( - byTestId('confirmation-message') + byTestId('confirmation-message'), ); expect(confirmationMessageElement.nativeElement.textContent.trim()).toBe( - expected + expected, ); } diff --git a/src/app/events/components/tests/tests.component.spec.ts b/src/app/events/components/tests/tests.component.spec.ts index 0dbd9d969..b8f2da349 100644 --- a/src/app/events/components/tests/tests.component.spec.ts +++ b/src/app/events/components/tests/tests.component.spec.ts @@ -11,7 +11,7 @@ describe('TestsComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [TestsComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/events/components/tests/tests.component.ts b/src/app/events/components/tests/tests.component.ts index d3e83aa6b..2d3c497d3 100644 --- a/src/app/events/components/tests/tests.component.ts +++ b/src/app/events/components/tests/tests.component.ts @@ -13,12 +13,15 @@ import { ActivatedRoute } from '@angular/router'; export class TestsComponent implements OnInit, OnDestroy { courseId$: Observable = this.route.paramMap.pipe( map((params) => Number(params.get('id'))), - distinctUntilChanged() + distinctUntilChanged(), ); destroy$ = new Subject(); - constructor(public state: TestStateService, private route: ActivatedRoute) {} + constructor( + public state: TestStateService, + private route: ActivatedRoute, + ) {} ngOnInit() { this.courseId$ diff --git a/src/app/events/pipes/test-summary-short.pipe.spec.ts b/src/app/events/pipes/test-summary-short.pipe.spec.ts index cadc05b85..b667708d1 100644 --- a/src/app/events/pipes/test-summary-short.pipe.spec.ts +++ b/src/app/events/pipes/test-summary-short.pipe.spec.ts @@ -11,7 +11,7 @@ describe('TestSummaryShortPipe', () => { let pipe: TestSummaryShortPipe; beforeEach(waitForAsync(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({}) + buildTestModuleMetadata({}), ).compileComponents(); pipe = new TestSummaryShortPipe(TestBed.inject(TranslateService)); })); diff --git a/src/app/events/pipes/test-summary-short.pipe.ts b/src/app/events/pipes/test-summary-short.pipe.ts index f73df585a..5847448f9 100644 --- a/src/app/events/pipes/test-summary-short.pipe.ts +++ b/src/app/events/pipes/test-summary-short.pipe.ts @@ -15,7 +15,7 @@ export class TestSummaryShortPipe implements PipeTransform { private getPoints(test: Test): string { return test.IsPointGrading ? `, ${test.MaxPointsAdjusted ?? test.MaxPoints} ${this.translate.instant( - 'tests.summary.points' + 'tests.summary.points', )}` : ''; } diff --git a/src/app/events/services/events-state.service.ts b/src/app/events/services/events-state.service.ts index c4dab84ff..f4ae89b45 100644 --- a/src/app/events/services/events-state.service.ts +++ b/src/app/events/services/events-state.service.ts @@ -46,7 +46,7 @@ export class EventsStateService { private events$ = this.loadEvents(); filteredEvents$ = combineLatest([this.events$, this.search$]).pipe( - map(spread(searchEntries)) + map(spread(searchEntries)), ); constructor( @@ -56,7 +56,7 @@ export class EventsStateService { private storage: StorageService, private translate: TranslateService, private eventsRestService: EventsRestService, - @Inject(SETTINGS) private settings: Settings + @Inject(SETTINGS) private settings: Settings, ) {} /** @@ -72,8 +72,8 @@ export class EventsStateService { this.studyClasses$, ]).pipe(map(spread(this.createAndSortEvents.bind(this)))) : this.coursesNotRated$.pipe( - map((course) => this.createAndSortEvents(course)) - ) + map((course) => this.createAndSortEvents(course)), + ), ); } @@ -86,10 +86,10 @@ export class EventsStateService { private createAndSortEvents( courses: ReadonlyArray, formativeAssessments: ReadonlyArray = [], - studyClasses: ReadonlyArray = [] + studyClasses: ReadonlyArray = [], ): ReadonlyArray { const classesWithoutAssessments = studyClasses.filter( - (c) => !formativeAssessments.map((fa) => fa.Id).includes(c.Id) + (c) => !formativeAssessments.map((fa) => fa.Id).includes(c.Id), ); return [ ...this.createFromCourses(courses), @@ -99,7 +99,7 @@ export class EventsStateService { } private createFromStudyClasses( - studyClasses: ReadonlyArray + studyClasses: ReadonlyArray, ): ReadonlyArray { return studyClasses.map((studyClass) => ({ id: studyClass.Id, @@ -111,7 +111,7 @@ export class EventsStateService { } private createFromAssessments( - studyClasses: ReadonlyArray + studyClasses: ReadonlyArray, ): ReadonlyArray { const events = this.createFromStudyClasses(studyClasses); @@ -124,7 +124,7 @@ export class EventsStateService { } private createFromCourses( - courses: ReadonlyArray + courses: ReadonlyArray, ): ReadonlyArray { return courses.map((course) => { const state = getEventState(course); @@ -139,7 +139,7 @@ export class EventsStateService { state: state?.value || null, evaluationText: this.getEvaluationText( state, - course.EvaluationStatusRef.EvaluationUntil + course.EvaluationStatusRef.EvaluationUntil, ), evaluationLink: this.getEvaluationLink(state?.value, course), }; @@ -148,7 +148,7 @@ export class EventsStateService { private getEvaluationText( state: Option, - date?: Maybe + date?: Maybe, ): string { const label = state?.label || state?.value; return label @@ -161,7 +161,7 @@ export class EventsStateService { private getEvaluationLink( state: Maybe, - course: Course + course: Course, ): Option { return state && state !== EventState.Tests ? this.buildLink(course.Id, 'evaluation') diff --git a/src/app/events/services/test-state.service.spec.ts b/src/app/events/services/test-state.service.spec.ts index e833e23e8..fd46bb75b 100644 --- a/src/app/events/services/test-state.service.spec.ts +++ b/src/app/events/services/test-state.service.spec.ts @@ -8,7 +8,7 @@ describe('TestStateService', () => { beforeEach(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({ providers: [TestStateService] }) + buildTestModuleMetadata({ providers: [TestStateService] }), ); service = TestBed.inject(TestStateService); }); diff --git a/src/app/events/services/test-state.service.ts b/src/app/events/services/test-state.service.ts index 6ac35445b..79eb90281 100644 --- a/src/app/events/services/test-state.service.ts +++ b/src/app/events/services/test-state.service.ts @@ -59,10 +59,10 @@ export class TestStateService { private fetchedCourse$ = this._courseId$.pipe( switchMap((courseId) => this.loadingService.load( - this.coursesRestService.getExpandedCourse(courseId) - ) + this.coursesRestService.getExpandedCourse(courseId), + ), ), - shareReplay(1) + shareReplay(1), ); course$: Observable = merge(this.action$, this.fetchedCourse$).pipe( @@ -76,18 +76,18 @@ export class TestStateService { }; }), scan(courseReducer, null as Option), - filter(notNull) + filter(notNull), ); tests$ = this.course$.pipe( map((course: Course) => course.Tests || []), - map(sortByDate) + map(sortByDate), ); filter$: BehaviorSubject = new BehaviorSubject('all-tests'); expandedHeader$: BehaviorSubject = new BehaviorSubject( - false + false, ); filteredTests$ = combineLatest([this.tests$, this.filter$]).pipe( @@ -98,8 +98,8 @@ export class TestStateService { } else { return test.IsOwner; } - }) - ) + }), + ), ); sorting$ = this.sortService.sorting$; @@ -117,12 +117,12 @@ export class TestStateService { uniq([ ...(course.Tests ?? []).map((test: Test) => test.GradingScaleId), course.GradingScaleId, - ]) - ) + ]), + ), ); private gradingScales$ = this.gradingScalesRestService.loadGradingScales( - this.gradingScaleIds$ + this.gradingScaleIds$, ); private UNDEFINED_GRADINGSCALE_ID = -1; @@ -149,14 +149,14 @@ export class TestStateService { ...gradingScaleOptions, [option.id]: option.options, }), - {} - ) + {}, + ), ), - shareReplay(1) + shareReplay(1), ); meanOfStudentGradesForCourse$: Observable = this.studentGrades$.pipe( - map((studentGrades) => meanOf(pluckFinalGrades(studentGrades))) + map((studentGrades) => meanOf(pluckFinalGrades(studentGrades))), ); meanOfFinalGradesForCourse$: Observable = combineLatest([ @@ -169,7 +169,7 @@ export class TestStateService { private gradingScalesRestService: GradingScalesRestService, private gradingsRestService: GradingsRestService, private loadingService: LoadingService, - private sortService: SortService + private sortService: SortService, ) {} setCourseId(id: number) { @@ -182,20 +182,22 @@ export class TestStateService { gradingOptionsForCourse$() { return this.course$.pipe( - switchMap((course: Course) => this.gradingOptions$(course.GradingScaleId)) + switchMap((course: Course) => + this.gradingOptions$(course.GradingScaleId), + ), ); } toStudentGrades( course: Course, tests: Test[] = [], - sorting: Sorting + sorting: Sorting, ): StudentGrade[] { return transform( course.ParticipatingStudents ?? [], tests, course.Gradings ?? [], - course.FinalGrades ?? [] + course.FinalGrades ?? [], ).sort(compareFn(sorting)); } @@ -220,8 +222,8 @@ export class TestStateService { .pipe( take(1), switchMap((course: Course) => - this.coursesRestService.updateTestResult(course.Id, requestBody) - ) + this.coursesRestService.updateTestResult(course.Id, requestBody), + ), ) .subscribe((response) => this.updateStudentGrades(response)); } @@ -264,7 +266,7 @@ export class TestStateService { this.action$.next({ type: 'replace-grades', payload: response.Gradings, - }) + }), ); } @@ -273,7 +275,7 @@ export class TestStateService { body: UpdatedTestResultResponse; }) { const grading: Grading | undefined = newGrades.body.Gradings.find( - (grading: Grading) => grading.EventId === newGrades.courseId + (grading: Grading) => grading.EventId === newGrades.courseId, ); if (grading === undefined) return; this.action$.next({ @@ -296,13 +298,13 @@ export class TestStateService { if (gradingScaleId === null) return of(null); return this.gradingScalesOptions$.pipe( map((gradingScaleOptions) => gradingScaleOptions[gradingScaleId]), - shareReplay(1) + shareReplay(1), ); } private meanOfOverwrittenGradesForCourse( gradingScaleOptions: GradingScaleOptions, - studentGrades: StudentGrade[] + studentGrades: StudentGrade[], ): Observable { return this.course$.pipe( map((course: Course) => { @@ -311,7 +313,7 @@ export class TestStateService { return null; const scale = gradingScaleOptions[course.GradingScaleId]!; return averageOfGradesForScale(pluckFinalGrades(studentGrades), scale); - }) + }), ); } } diff --git a/src/app/events/utils/course-reducer.ts b/src/app/events/utils/course-reducer.ts index b9170994c..1b6f31bb0 100644 --- a/src/app/events/utils/course-reducer.ts +++ b/src/app/events/utils/course-reducer.ts @@ -19,7 +19,7 @@ export type TestsAction = export function courseReducer( course: Option, - action: TestsAction + action: TestsAction, ): Option { switch (action.type) { case 'reset': @@ -31,7 +31,7 @@ export function courseReducer( Tests: replaceResult(action.payload.testResult, course.Tests || []), Gradings: replaceGrading( action.payload.grading, - course.Gradings || [] + course.Gradings || [], ), } : null; @@ -51,7 +51,7 @@ export function courseReducer( id: action.payload.id, selectedGradeId: action.payload.selectedGradeId, }, - course.Gradings || [] + course.Gradings || [], ), } : null; diff --git a/src/app/events/utils/gradings.spec.ts b/src/app/events/utils/gradings.spec.ts index d30e69db3..6665706b8 100644 --- a/src/app/events/utils/gradings.spec.ts +++ b/src/app/events/utils/gradings.spec.ts @@ -37,7 +37,7 @@ describe('Gradings utils', () => { it('should change to gradeId of the given grade', () => { const result = changeGrading( { id: 12345, selectedGradeId: 999 }, - gradings + gradings, ); expect(result.length).toBe(3); diff --git a/src/app/events/utils/gradings.ts b/src/app/events/utils/gradings.ts index 10906a4dd..93d75090c 100644 --- a/src/app/events/utils/gradings.ts +++ b/src/app/events/utils/gradings.ts @@ -8,9 +8,9 @@ export function replaceGrading(newGrading: Grading, gradings: Grading[]) { } export function changeGrading( { id, selectedGradeId }: { id: number; selectedGradeId: number }, - gradings: Grading[] + gradings: Grading[], ) { return gradings.map((grade) => - grade.Id !== id ? grade : { ...grade, GradeId: selectedGradeId } + grade.Id !== id ? grade : { ...grade, GradeId: selectedGradeId }, ); } diff --git a/src/app/events/utils/tests.spec.ts b/src/app/events/utils/tests.spec.ts index ce2b70121..15f057dc4 100644 --- a/src/app/events/utils/tests.spec.ts +++ b/src/app/events/utils/tests.spec.ts @@ -113,14 +113,14 @@ describe('Test utils', () => { describe('should calculate averages from test', () => { it('should calculate points average', () => { expect(() => averagePoints(buildTest(1, 1, []))).toThrow( - new Error('unable to calculate averages without results') + new Error('unable to calculate averages without results'), ); expect(averagePoints(test)).toBe(11.263636363636364); }); it('should calculate grade averages', () => { expect(() => averageGrade(buildTest(1, 1, []))).toThrow( - new Error('unable to calculate averages without results') + new Error('unable to calculate averages without results'), ); expect(averageGrade(test)).toBe(3.8272727272727276); }); diff --git a/src/app/events/utils/tests.ts b/src/app/events/utils/tests.ts index af714c1fe..ce8bc0985 100644 --- a/src/app/events/utils/tests.ts +++ b/src/app/events/utils/tests.ts @@ -4,13 +4,13 @@ import { GradingScale } from '../../shared/models/grading-scale.model'; export function replaceResult(result: Result, tests: Test[]): Test[] { return tests.map((test) => - test.Id === result.TestId ? replaceResultInTest(result, test) : test + test.Id === result.TestId ? replaceResultInTest(result, test) : test, ); } export function toggleIsPublished(id: number, tests: Test[]) { return tests.map((test) => - test.Id === id ? { ...test, IsPublished: !test.IsPublished } : test + test.Id === id ? { ...test, IsPublished: !test.IsPublished } : test, ); } @@ -42,7 +42,7 @@ export function resultOfStudent(studentId: number, test: Test): Maybe { export function removeTestById( testId: number, - tests: Test[] | null + tests: Test[] | null, ): Test[] | null { if (tests === null) return null; return tests.filter((test) => test.Id !== testId); @@ -62,11 +62,11 @@ export function sortByDate(tests: Test[]) { export function gradingScaleOfTest( test: Test, - gradingScales: GradingScale[] + gradingScales: GradingScale[], ): Option { return ( gradingScales?.find( - (gradingScale) => gradingScale.Id === test.GradingScaleId + (gradingScale) => gradingScale.Id === test.GradingScaleId, ) || null ); } @@ -82,7 +82,7 @@ function extractGrades(test: Test) { function extractPoints(test: Test) { return ( test.Results?.map((result) => - result.Points !== null ? result.Points : IMPOSSIBLE_POINTS + result.Points !== null ? result.Points : IMPOSSIBLE_POINTS, ).filter((point) => point > IMPOSSIBLE_POINTS) || [] ); } diff --git a/src/app/home.component.spec.ts b/src/app/home.component.spec.ts index 798ac5a13..325fadf44 100644 --- a/src/app/home.component.spec.ts +++ b/src/app/home.component.spec.ts @@ -12,7 +12,7 @@ describe('HomeComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [HomeComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-absences/components/my-absences-confirm/my-absences-abstract-confirm.component.ts b/src/app/my-absences/components/my-absences-confirm/my-absences-abstract-confirm.component.ts index df59fe3ee..506a44fa2 100644 --- a/src/app/my-absences/components/my-absences-confirm/my-absences-abstract-confirm.component.ts +++ b/src/app/my-absences/components/my-absences-confirm/my-absences-abstract-confirm.component.ts @@ -34,14 +34,14 @@ export abstract class MyAbsencesAbstractConfirmComponent this.getHalfDayType(), ]).pipe( map(([confirmationTypes, halfDayType]) => - halfDayType ? [...confirmationTypes, halfDayType] : confirmationTypes - ) + halfDayType ? [...confirmationTypes, halfDayType] : confirmationTypes, + ), ); absenceTypeIdErrors$ = getValidationErrors( of(this.formGroup), this.submitted$, - 'absenceTypeId' + 'absenceTypeId', ); abstract selectedLessonIds$: Observable>; @@ -57,7 +57,7 @@ export abstract class MyAbsencesAbstractConfirmComponent protected presenceTypesService: PresenceTypesService, protected updateService: LessonPresencesUpdateRestService, protected storageService: StorageService, - protected settings: Settings + protected settings: Settings, ) {} ngOnInit(): void { @@ -91,9 +91,9 @@ export abstract class MyAbsencesAbstractConfirmComponent return this.presenceTypesService.confirmationTypes$.pipe( map((types) => types.filter( - (t) => t.IsAbsence && t.Id !== this.settings.halfDayPresenceTypeId - ) - ) + (t) => t.IsAbsence && t.Id !== this.settings.halfDayPresenceTypeId, + ), + ), ); } @@ -117,17 +117,17 @@ export abstract class MyAbsencesAbstractConfirmComponent this.updateService.editLessonPresences( selectedLessonIds, [Number(this.storageService.getPayload()?.id_person)], - absenceTypeId - ) + absenceTypeId, + ), ), - finalize(() => this.saving$.next(false)) + finalize(() => this.saving$.next(false)), ) .subscribe(this.onSaveSuccess.bind(this)); } protected onSaveSuccess(): void { this.toastService.success( - this.translate.instant('my-absences.confirm.save-success') + this.translate.instant('my-absences.confirm.save-success'), ); this.navigateBack(); } diff --git a/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.spec.ts b/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.spec.ts index eaa08b0b9..eb967f08d 100644 --- a/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.spec.ts +++ b/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.spec.ts @@ -29,7 +29,7 @@ describe('MyAbsencesConfirmComponent', () => { }, }, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.ts b/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.ts index f8038fcc9..7a8e314cb 100644 --- a/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.ts +++ b/src/app/my-absences/components/my-absences-confirm/my-absences-confirm.component.ts @@ -22,7 +22,7 @@ import { ToastService } from '../../../shared/services/toast.service'; }) export class MyAbsencesConfirmComponent extends MyAbsencesAbstractConfirmComponent { selectedLessonIds$ = this.selectionService.selectedIds$.pipe( - map((selectedIds) => uniq(flatten(selectedIds.map((s) => s.lessonIds)))) + map((selectedIds) => uniq(flatten(selectedIds.map((s) => s.lessonIds)))), ); protected confirmationStateId = this.settings.unconfirmedAbsencesRefreshTime; @@ -36,7 +36,7 @@ export class MyAbsencesConfirmComponent extends MyAbsencesAbstractConfirmCompone storageService: StorageService, @Inject(SETTINGS) settings: Settings, private myAbsencesService: MyAbsencesService, - private selectionService: ConfirmAbsencesSelectionService + private selectionService: ConfirmAbsencesSelectionService, ) { super( fb, @@ -46,7 +46,7 @@ export class MyAbsencesConfirmComponent extends MyAbsencesAbstractConfirmCompone presenceTypesService, updateService, storageService, - settings + settings, ); } diff --git a/src/app/my-absences/components/my-absences-confirm/my-absences-report-confirm.component.ts b/src/app/my-absences/components/my-absences-confirm/my-absences-report-confirm.component.ts index aac1c3d5f..30540578c 100644 --- a/src/app/my-absences/components/my-absences-confirm/my-absences-report-confirm.component.ts +++ b/src/app/my-absences/components/my-absences-confirm/my-absences-report-confirm.component.ts @@ -24,7 +24,7 @@ import { ToastService } from '../../../shared/services/toast.service'; }) export class MyAbsencesReportConfirmComponent extends MyAbsencesAbstractConfirmComponent { selectedLessonIds$ = this.selectionService.selectedIds$.pipe( - map((selectedIds) => uniq(flatten(selectedIds.map((s) => s.lessonIds)))) + map((selectedIds) => uniq(flatten(selectedIds.map((s) => s.lessonIds)))), ); protected confirmationStateId = this.settings.checkableAbsenceStateId; @@ -38,7 +38,7 @@ export class MyAbsencesReportConfirmComponent extends MyAbsencesAbstractConfirmC storageService: StorageService, @Inject(SETTINGS) settings: Settings, private state: MyAbsencesReportStateService, - private selectionService: MyAbsencesReportSelectionService + private selectionService: MyAbsencesReportSelectionService, ) { super( fb, @@ -48,7 +48,7 @@ export class MyAbsencesReportConfirmComponent extends MyAbsencesAbstractConfirmC presenceTypesService, updateService, storageService, - settings + settings, ); } diff --git a/src/app/my-absences/components/my-absences-report-header/my-absences-report-header.component.spec.ts b/src/app/my-absences/components/my-absences-report-header/my-absences-report-header.component.spec.ts index 7cc359789..f3728393c 100644 --- a/src/app/my-absences/components/my-absences-report-header/my-absences-report-header.component.spec.ts +++ b/src/app/my-absences/components/my-absences-report-header/my-absences-report-header.component.spec.ts @@ -11,7 +11,7 @@ describe('MyAbsencesReportHeaderComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [MyAbsencesReportHeaderComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-absences/components/my-absences-report-link/my-absences-report-link.component.spec.ts b/src/app/my-absences/components/my-absences-report-link/my-absences-report-link.component.spec.ts index dc84e4fed..a3d47e160 100644 --- a/src/app/my-absences/components/my-absences-report-link/my-absences-report-link.component.spec.ts +++ b/src/app/my-absences/components/my-absences-report-link/my-absences-report-link.component.spec.ts @@ -12,8 +12,8 @@ describe('MyAbsencesEditLinkComponent', () => { buildTestModuleMetadata( buildTestModuleMetadata({ declarations: [MyAbsencesReportLinkComponent], - }) - ) + }), + ), ).compileComponents(); })); diff --git a/src/app/my-absences/components/my-absences-report-list/my-absences-report-list.component.spec.ts b/src/app/my-absences/components/my-absences-report-list/my-absences-report-list.component.spec.ts index e36ea89c9..320522630 100644 --- a/src/app/my-absences/components/my-absences-report-list/my-absences-report-list.component.spec.ts +++ b/src/app/my-absences/components/my-absences-report-list/my-absences-report-list.component.spec.ts @@ -34,7 +34,7 @@ describe('MyAbsencesReportListComponent', () => { }, MyAbsencesReportSelectionService, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-absences/components/my-absences-report/my-absences-report.component.spec.ts b/src/app/my-absences/components/my-absences-report/my-absences-report.component.spec.ts index 312c86a2d..dbfa8d7b7 100644 --- a/src/app/my-absences/components/my-absences-report/my-absences-report.component.spec.ts +++ b/src/app/my-absences/components/my-absences-report/my-absences-report.component.spec.ts @@ -11,7 +11,7 @@ describe('MyAbsencesReportComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [MyAbsencesReportComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-absences/components/my-absences/my-absences.component.spec.ts b/src/app/my-absences/components/my-absences/my-absences.component.spec.ts index 5a8e8f384..54409b695 100644 --- a/src/app/my-absences/components/my-absences/my-absences.component.spec.ts +++ b/src/app/my-absences/components/my-absences/my-absences.component.spec.ts @@ -11,7 +11,7 @@ describe('MyAbsencesComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [MyAbsencesComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-absences/services/my-absences-report-state.service.ts b/src/app/my-absences/services/my-absences-report-state.service.ts index d094e1278..b4eae4445 100644 --- a/src/app/my-absences/services/my-absences-report-state.service.ts +++ b/src/app/my-absences/services/my-absences-report-state.service.ts @@ -40,14 +40,14 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< @Inject(SETTINGS) settings: Settings, private studentsService: StudentsRestService, private storageService: StorageService, - sortService: SortService + sortService: SortService, ) { super( location, loadingService, sortService, settings, - '/my-absences/report' + '/my-absences/report', ); const currentInstanceId = this.storageService.getPayload()?.instance_id; @@ -71,13 +71,13 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< protected loadEntries( filterValue: ReportAbsencesFilter, _sorting: null, - _offset: number + _offset: number, ): Observable>> { const params = this.buildRequestParamsFromFilter(filterValue) .set('sort', 'From.asc') .set( 'fields', - 'Id,From,To,EventNumber,EventDesignation,EventManagerInformation' + 'Id,From,To,EventNumber,EventDesignation,EventManagerInformation', ); return this.loadingService.load( this.loadTimetableEntries(params).pipe( @@ -87,20 +87,20 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< of(entries), this.loadLessonAbsences(entries), this.loadLessonDispensations(entries), - ]) + ]), ), map(([entries, absences, dispensations]) => - this.buildLessonPresences(entries, absences, dispensations) + this.buildLessonPresences(entries, absences, dispensations), ), // Pagination is ignored - map((entries) => ({ offset: 0, total: entries.length, entries })) + map((entries) => ({ offset: 0, total: entries.length, entries })), ), - PAGE_LOADING_CONTEXT + PAGE_LOADING_CONTEXT, ); } private filterAbsencesAfterLessonStart( - entries: ReadonlyArray + entries: ReadonlyArray, ): ReadonlyArray { return this.preventAbsencesAfterStart ? entries.filter((entry) => entry.From >= new Date()) @@ -120,19 +120,19 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< } private buildRequestParamsFromFilter( - filterValue: ReportAbsencesFilter + filterValue: ReportAbsencesFilter, ): HttpParams { let params = new HttpParams(); if (filterValue.dateFrom) { params = params.set( 'filter.From', - `>${format(subDays(filterValue.dateFrom, 1), 'yyyy-MM-dd')}` + `>${format(subDays(filterValue.dateFrom, 1), 'yyyy-MM-dd')}`, ); } if (filterValue.dateTo) { params = params.set( 'filter.To', - `<${format(addDays(filterValue.dateTo, 1), 'yyyy-MM-dd')}` + `<${format(addDays(filterValue.dateTo, 1), 'yyyy-MM-dd')}`, ); } return params; @@ -147,13 +147,13 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< } private loadTimetableEntries( - params: HttpParams | Dict + params: HttpParams | Dict, ): Observable> { return this.studentsService.getTimetableEntries(this.studentId, params); } private loadLessonAbsences( - timetableEntries: ReadonlyArray + timetableEntries: ReadonlyArray, ): Observable> { return timetableEntries.length > 0 ? this.studentsService.getLessonAbsences(this.studentId, { @@ -163,7 +163,7 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< } private loadLessonDispensations( - timetableEntries: ReadonlyArray + timetableEntries: ReadonlyArray, ): Observable> { return timetableEntries.length > 0 ? this.studentsService.getLessonDispensations(this.studentId, { @@ -175,21 +175,21 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< private buildLessonPresences( timetableEntries: ReadonlyArray, absences: ReadonlyArray, - dispensations: ReadonlyArray + dispensations: ReadonlyArray, ): ReadonlyArray { return timetableEntries.map((entry) => - this.buildLessonPresence(entry, absences, dispensations) + this.buildLessonPresence(entry, absences, dispensations), ); } private buildLessonPresence( timetableEntry: TimetableEntry, absences: ReadonlyArray, - dispensations: ReadonlyArray + dispensations: ReadonlyArray, ): LessonPresence { const absence = absences.find((a) => a.LessonRef.Id === timetableEntry.Id); const dispensation = dispensations.find( - (d) => d.LessonRef.Id === timetableEntry.Id + (d) => d.LessonRef.Id === timetableEntry.Id, ); const typeRef = this.buildLessonPresenceTypeRef(absence, dispensation); return { @@ -222,7 +222,7 @@ export class MyAbsencesReportStateService extends PaginatedEntriesService< private buildLessonPresenceTypeRef( absence?: LessonAbsence, - dispensation?: LessonDispensation + dispensation?: LessonDispensation, ): OptionalReference { if (absence) { return { ...absence.TypeRef }; diff --git a/src/app/my-grades/components/my-grades-header/my-grades-header.component.spec.ts b/src/app/my-grades/components/my-grades-header/my-grades-header.component.spec.ts index 1f8e000fd..d76cc1941 100644 --- a/src/app/my-grades/components/my-grades-header/my-grades-header.component.spec.ts +++ b/src/app/my-grades/components/my-grades-header/my-grades-header.component.spec.ts @@ -22,7 +22,7 @@ describe('MyGradesHeaderComponent', () => { }, }, ], - }) + }), ).compileComponents(); }); diff --git a/src/app/my-grades/components/my-grades-show/my-grades-show.component.spec.ts b/src/app/my-grades/components/my-grades-show/my-grades-show.component.spec.ts index a275894c4..016bc0546 100644 --- a/src/app/my-grades/components/my-grades-show/my-grades-show.component.spec.ts +++ b/src/app/my-grades/components/my-grades-show/my-grades-show.component.spec.ts @@ -28,7 +28,7 @@ describe('MyGradesShowComponent', () => { useValue: jasmine.createSpyObj('StorageService', ['getPayload']), }, ], - }) + }), ).compileComponents(); }); diff --git a/src/app/my-grades/components/my-grades/my-grades.component.spec.ts b/src/app/my-grades/components/my-grades/my-grades.component.spec.ts index 1f991cbd9..89863a314 100644 --- a/src/app/my-grades/components/my-grades/my-grades.component.spec.ts +++ b/src/app/my-grades/components/my-grades/my-grades.component.spec.ts @@ -13,7 +13,7 @@ describe('MyGradesComponent', () => { buildTestModuleMetadata({ declarations: [MyGradesComponent], imports: [RouterModule], - }) + }), ).compileComponents(); }); diff --git a/src/app/my-grades/services/my-grades.service.ts b/src/app/my-grades/services/my-grades.service.ts index 479c5962e..925cc5969 100644 --- a/src/app/my-grades/services/my-grades.service.ts +++ b/src/app/my-grades/services/my-grades.service.ts @@ -29,11 +29,11 @@ export class MyGradesService { map((courses) => courses .slice() - .sort((c1, c2) => c1.Designation.localeCompare(c2.Designation)) - ) + .sort((c1, c2) => c1.Designation.localeCompare(c2.Designation)), + ), ); private studentCourseIds$ = this.studentCourses$.pipe( - map((courses) => courses.flatMap((course: Course) => course.Id)) + map((courses) => courses.flatMap((course: Course) => course.Id)), ); private idSubscriptions$ = combineLatest([ @@ -43,36 +43,36 @@ export class MyGradesService { switchMap(([studentId, courseIds]) => this.subscriptionRestService.getIdSubscriptionsByStudentAndCourse( studentId, - courseIds - ) - ) + courseIds, + ), + ), ); private ids$ = this.idSubscriptions$.pipe( - map((subscriptions) => subscriptions.map((s) => s.Id)) + map((subscriptions) => subscriptions.map((s) => s.Id)), ); testReportUrl$ = this.ids$.pipe( map((ids) => this.reportsService.getSubscriptionReportUrl( this.settings.testsBySubscriptionReportIdStudent, - ids - ) - ) + ids, + ), + ), ); private tests$ = this.studentCourses$.pipe( map((courses) => - courses.flatMap((course: Course) => course.Tests).filter(notNull) - ) + courses.flatMap((course: Course) => course.Tests).filter(notNull), + ), ); private gradingScaleIdsFromTests$ = this.tests$.pipe( map((tests: Test[]) => [...tests.map((test: Test) => test.GradingScaleId)] .filter(notNull) - .filter(unique) - ) + .filter(unique), + ), ); private gradingScaleIdsFromCourses$ = this.studentCourses$.pipe( @@ -80,8 +80,8 @@ export class MyGradesService { courses .flatMap((course: Course) => course.GradingScaleId) .filter(notNull) - .filter(unique) - ) + .filter(unique), + ), ); private gradingScaleIds$ = combineLatest([ @@ -89,18 +89,18 @@ export class MyGradesService { this.gradingScaleIdsFromTests$, ]).pipe( map(([courseGradingsScaleIds, testGradingScaleIds]: [number[], number[]]) => - courseGradingsScaleIds.concat(testGradingScaleIds).filter(unique) - ) + courseGradingsScaleIds.concat(testGradingScaleIds).filter(unique), + ), ); gradingScales$ = this.gradingScaleIds$.pipe( switchMap((ids) => forkJoin( ids.map((id: number) => - this.gradingScalesRestService.getGradingScale(id) - ) - ) - ) + this.gradingScalesRestService.getGradingScale(id), + ), + ), + ), ); constructor( @@ -110,7 +110,7 @@ export class MyGradesService { private subscriptionRestService: SubscriptionsRestService, private reportsService: ReportsService, private gradingScalesRestService: GradingScalesRestService, - @Inject(SETTINGS) private settings: Settings + @Inject(SETTINGS) private settings: Settings, ) { const studentId = this.storageService.getPayload()?.id_person; if (studentId) { @@ -120,7 +120,7 @@ export class MyGradesService { private loadCourses() { return this.loadingService.load( - this.coursesRestService.getExpandedCoursesForStudent() + this.coursesRestService.getExpandedCoursesForStudent(), ); } } diff --git a/src/app/my-profile/components/my-profile-edit/my-profile-edit.component.ts b/src/app/my-profile/components/my-profile-edit/my-profile-edit.component.ts index d8e0213ae..1170eca14 100644 --- a/src/app/my-profile/components/my-profile-edit/my-profile-edit.component.ts +++ b/src/app/my-profile/components/my-profile-edit/my-profile-edit.component.ts @@ -25,7 +25,7 @@ export class MyProfileEditComponent { student$ = this.profileService.profile$.pipe(map(({ student }) => student)); formGroup$ = this.student$.pipe( map(this.createFormGroup.bind(this)), - shareReplay(1) + shareReplay(1), ); saving$ = new BehaviorSubject(false); @@ -34,7 +34,7 @@ export class MyProfileEditComponent { email2Errors$ = getValidationErrors( this.formGroup$, this.submitted$, - 'email2' + 'email2', ); constructor( @@ -43,7 +43,7 @@ export class MyProfileEditComponent { private toastService: ToastService, private translate: TranslateService, private profileService: MyProfileService, - private personsService: PersonsRestService + private personsService: PersonsRestService, ) {} cancel(): void { @@ -58,7 +58,7 @@ export class MyProfileEditComponent { this.save( phonePrivate?.trim() || null, phoneMobile?.trim() || null, - email2 || null + email2 || null, ); } }); @@ -75,7 +75,7 @@ export class MyProfileEditComponent { private save( phonePrivate: Option, phoneMobile: Option, - email2: Maybe + email2: Maybe, ): void { this.saving$.next(true); this.student$ @@ -86,10 +86,10 @@ export class MyProfileEditComponent { student.Id, phonePrivate, phoneMobile, - email2 - ) + email2, + ), ), - finalize(() => this.saving$.next(false)) + finalize(() => this.saving$.next(false)), ) .subscribe(this.onSaveSuccess.bind(this)); } @@ -97,7 +97,7 @@ export class MyProfileEditComponent { private onSaveSuccess(): void { this.profileService.reset(); // Ensure the profile will be reloaded this.toastService.success( - this.translate.instant('my-profile.edit.save-success') + this.translate.instant('my-profile.edit.save-success'), ); this.navigateBack(); } diff --git a/src/app/my-profile/components/my-profile-entry/my-profile-entry.component.spec.ts b/src/app/my-profile/components/my-profile-entry/my-profile-entry.component.spec.ts index 3a2774bb1..eab5213e6 100644 --- a/src/app/my-profile/components/my-profile-entry/my-profile-entry.component.spec.ts +++ b/src/app/my-profile/components/my-profile-entry/my-profile-entry.component.spec.ts @@ -11,7 +11,7 @@ describe('MyProfileEntryComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [MyProfileEntryComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-profile/components/my-profile-header/my-profile-header.component.spec.ts b/src/app/my-profile/components/my-profile-header/my-profile-header.component.spec.ts index 8fd626e91..18ca53807 100644 --- a/src/app/my-profile/components/my-profile-header/my-profile-header.component.spec.ts +++ b/src/app/my-profile/components/my-profile-header/my-profile-header.component.spec.ts @@ -18,7 +18,7 @@ describe('MyProfileHeaderComponent', () => { useValue: { personMasterDataReportUrl: '/report' }, }, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-profile/components/my-profile-show/my-profile-show.component.spec.ts b/src/app/my-profile/components/my-profile-show/my-profile-show.component.spec.ts index 1090345ff..811fec745 100644 --- a/src/app/my-profile/components/my-profile-show/my-profile-show.component.spec.ts +++ b/src/app/my-profile/components/my-profile-show/my-profile-show.component.spec.ts @@ -13,7 +13,7 @@ describe('MyProfileShowComponent', () => { buildTestModuleMetadata({ declarations: [MyProfileShowComponent], providers: [MyProfileService], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-profile/components/my-profile/my-profile.component.spec.ts b/src/app/my-profile/components/my-profile/my-profile.component.spec.ts index 048491a31..8540a0d99 100644 --- a/src/app/my-profile/components/my-profile/my-profile.component.spec.ts +++ b/src/app/my-profile/components/my-profile/my-profile.component.spec.ts @@ -11,7 +11,7 @@ describe('MyProfileComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [MyProfileComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/my-profile/services/my-profile.service.spec.ts b/src/app/my-profile/services/my-profile.service.spec.ts index 499f3f42d..bee1fc11a 100644 --- a/src/app/my-profile/services/my-profile.service.spec.ts +++ b/src/app/my-profile/services/my-profile.service.spec.ts @@ -10,7 +10,7 @@ describe('MyProfileService', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ providers: [MyProfileService], - }) + }), ); service = TestBed.inject(MyProfileService); }); diff --git a/src/app/my-profile/services/my-profile.service.ts b/src/app/my-profile/services/my-profile.service.ts index a72b3508c..5aff72312 100644 --- a/src/app/my-profile/services/my-profile.service.ts +++ b/src/app/my-profile/services/my-profile.service.ts @@ -9,7 +9,7 @@ export class MyProfileService { private reset$ = new BehaviorSubject(undefined); profile$ = this.reset$.pipe( switchMap(() => this.profileService.getMyProfile()), - shareReplay(1) + shareReplay(1), ); loading$ = this.profileService.loading$; diff --git a/src/app/my-settings/components/my-settings/my-settings.component.spec.ts b/src/app/my-settings/components/my-settings/my-settings.component.spec.ts index 8501969c2..0ad816b92 100644 --- a/src/app/my-settings/components/my-settings/my-settings.component.spec.ts +++ b/src/app/my-settings/components/my-settings/my-settings.component.spec.ts @@ -11,7 +11,7 @@ describe('MySettingsComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [MySettingsComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/open-absences/components/open-absences-detail/open-absences-detail.component.ts b/src/app/open-absences/components/open-absences-detail/open-absences-detail.component.ts index 94b78bef2..c6b6c1216 100644 --- a/src/app/open-absences/components/open-absences-detail/open-absences-detail.component.ts +++ b/src/app/open-absences/components/open-absences-detail/open-absences-detail.component.ts @@ -28,11 +28,11 @@ export class OpenAbsencesDetailComponent implements OnInit, AfterViewInit, OnDestroy { absences$ = this.route.paramMap.pipe( - switchMap(this.getAbsencesForParams.bind(this)) + switchMap(this.getAbsencesForParams.bind(this)), ); hasAbsences$ = this.absences$.pipe(map(longerOrEqual(1))); studentFullName$ = this.absences$.pipe( - map((absences) => (absences[0] && absences[0].StudentFullName) || null) + map((absences) => (absences[0] && absences[0].StudentFullName) || null), ); allSelected$ = combineLatest([ this.absences$, @@ -42,20 +42,20 @@ export class OpenAbsencesDetailComponent studentEmail$ = this.absences$.pipe( map((absences) => (absences[0] && absences[0].StudentRef.Id) || null), switchMap((id) => - id ? this.personService.getByIdWithEmailInfos(id) : EMPTY - ) + id ? this.personService.getByIdWithEmailInfos(id) : EMPTY, + ), ); allUnconfirmedAbsencesForStudent$ = this.route.paramMap.pipe( - switchMap(this.getAbsencesForStudentParam.bind(this)) + switchMap(this.getAbsencesForStudentParam.bind(this)), ); mailTo$ = combineLatest([ this.studentEmail$, this.allUnconfirmedAbsencesForStudent$, ]).pipe( map(([email, absences]) => - this.openAbsencesService.buildMailToString(email, absences) - ) + this.openAbsencesService.buildMailToString(email, absences), + ), ); private destroy$ = new Subject(); @@ -67,7 +67,7 @@ export class OpenAbsencesDetailComponent private presenceTypesService: PresenceTypesService, private personService: PersonsRestService, public selectionService: ConfirmAbsencesSelectionService, - private scrollPosition: ScrollPositionService + private scrollPosition: ScrollPositionService, ) {} ngOnInit(): void { @@ -80,7 +80,7 @@ export class OpenAbsencesDetailComponent (this.openAbsencesService.currentDetail = { date: String(params.get('date')), personId: Number(params.get('personId')), - }) + }), ); // If there are no entries, return to main list @@ -114,7 +114,7 @@ export class OpenAbsencesDetailComponent } getPresenceTypeDesignation( - lessonPresence: LessonPresence + lessonPresence: LessonPresence, ): Observable> { return this.presenceTypesService.displayedTypes$.pipe( map( @@ -122,25 +122,25 @@ export class OpenAbsencesDetailComponent (lessonPresence.TypeRef.Id && types.find((t) => t.Id === lessonPresence.TypeRef.Id) ?.Designation) || - null - ) + null, + ), ); } private getAbsencesForParams( - params: ParamMap + params: ParamMap, ): Observable> { return this.openAbsencesService.getUnconfirmedAbsences( String(params.get('date')), - Number(params.get('personId')) + Number(params.get('personId')), ); } private getAbsencesForStudentParam( - params: ParamMap + params: ParamMap, ): Observable> { return this.openAbsencesService.getAllUnconfirmedAbsencesForStudent( - Number(params.get('personId')) + Number(params.get('personId')), ); } } diff --git a/src/app/open-absences/components/open-absences-list/open-absences-list.component.ts b/src/app/open-absences/components/open-absences-list/open-absences-list.component.ts index a0518afb6..019a33156 100644 --- a/src/app/open-absences/components/open-absences-list/open-absences-list.component.ts +++ b/src/app/open-absences/components/open-absences-list/open-absences-list.component.ts @@ -31,7 +31,7 @@ export class OpenAbsencesListComponent constructor( public openAbsencesService: OpenAbsencesService, public selectionService: ConfirmAbsencesSelectionService, - private scrollPosition: ScrollPositionService + private scrollPosition: ScrollPositionService, ) {} ngOnInit(): void { @@ -63,7 +63,7 @@ export class OpenAbsencesListComponent getSortDirectionCharacter( sortCriteria: SortCriteria, - sortKey: PrimarySortKey + sortKey: PrimarySortKey, ): string { if (sortCriteria.primarySortKey !== sortKey) { return ''; diff --git a/src/app/open-absences/models/open-absences-entry.model.spec.ts b/src/app/open-absences/models/open-absences-entry.model.spec.ts index 1a315c080..c87b50ff6 100644 --- a/src/app/open-absences/models/open-absences-entry.model.spec.ts +++ b/src/app/open-absences/models/open-absences-entry.model.spec.ts @@ -11,16 +11,16 @@ describe('OpenAbsencesEntry', () => { 10, 21, 11, - new Date(2000, 0, 23, 12) + new Date(2000, 0, 23, 12), ); presenceB = buildLessonPresenceWithIds( 11, 21, 11, - new Date(2000, 0, 23, 13) + new Date(2000, 0, 23, 13), ); [presenceA, presenceB].forEach( - (p) => (p.StudentFullName = 'Albert Einstein') + (p) => (p.StudentFullName = 'Albert Einstein'), ); jasmine.clock().install(); @@ -31,7 +31,7 @@ describe('OpenAbsencesEntry', () => { it('throws an execption if initialized with an empty array', () => { expect(() => new OpenAbsencesEntry([])).toThrow( - new Error('Absences array is empty') + new Error('Absences array is empty'), ); }); }); diff --git a/src/app/open-absences/utils/open-absences-entries.spec.ts b/src/app/open-absences/utils/open-absences-entries.spec.ts index 6f7a5d0c6..3158aae5b 100644 --- a/src/app/open-absences/utils/open-absences-entries.spec.ts +++ b/src/app/open-absences/utils/open-absences-entries.spec.ts @@ -20,35 +20,35 @@ describe('open absences entries utils', () => { 10, 21, 11, - new Date(2000, 0, 23, 8, 15, 0) + new Date(2000, 0, 23, 8, 15, 0), ); presenceB = buildLessonPresenceWithIds( 11, 21, 11, - new Date(2000, 0, 23, 12, 30, 0) + new Date(2000, 0, 23, 12, 30, 0), ); presenceC = buildLessonPresenceWithIds( 12, 21, 11, - new Date(2000, 0, 24, 8, 15, 0) + new Date(2000, 0, 24, 8, 15, 0), ); presenceD = buildLessonPresenceWithIds( 10, 22, 11, - new Date(2000, 0, 23, 12, 30, 0) + new Date(2000, 0, 23, 12, 30, 0), ); presenceE = buildLessonPresenceWithIds( 10, 21, 11, - new Date(2000, 0, 23, 9, 0, 0) + new Date(2000, 0, 23, 9, 0, 0), ); [presenceA, presenceB, presenceC, presenceE].forEach( - (p) => (p.StudentFullName = 'Max Frisch') + (p) => (p.StudentFullName = 'Max Frisch'), ); presenceD.StudentFullName = 'Albert Einstein'; }); @@ -149,7 +149,7 @@ describe('open absences entries utils', () => { it('removes entries matching the affected ids', () => { const result = removeOpenAbsences( [presenceA, presenceB, presenceC, presenceD], - [{ lessonIds: [10, 11], personId: 21 }] + [{ lessonIds: [10, 11], personId: 21 }], ); expect(result).toEqual([presenceC, presenceD]); @@ -159,7 +159,7 @@ describe('open absences entries utils', () => { function openAbsencesEntriesComparator( a: OpenAbsencesEntry, - b: OpenAbsencesEntry + b: OpenAbsencesEntry, ): number { const dateDiff = a.date.getTime() - b.date.getTime(); if (dateDiff === 0) { diff --git a/src/app/person-search/components/person-search-header/person-search-header.component.ts b/src/app/person-search/components/person-search-header/person-search-header.component.ts index f089ad68a..281c01aba 100644 --- a/src/app/person-search/components/person-search-header/person-search-header.component.ts +++ b/src/app/person-search/components/person-search-header/person-search-header.component.ts @@ -15,7 +15,7 @@ export interface StudentFilter { export class PersonSearchHeaderComponent { constructor( public studentsRestService: StudentsRestService, - private router: Router + private router: Router, ) {} filter: StudentFilter = { diff --git a/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.spec.ts b/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.spec.ts index 84c6e32e4..797b2f1d0 100644 --- a/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.spec.ts +++ b/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.spec.ts @@ -13,7 +13,7 @@ describe('PresenceControlBlockLessonComponent', () => { buildTestModuleMetadata({ declarations: [PresenceControlBlockLessonComponent], providers: [NgbActiveModal], - }) + }), ).compileComponents(); })); diff --git a/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.ts b/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.ts index ab2dd321f..9beda2507 100644 --- a/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.ts +++ b/src/app/presence-control/components/presence-control-block-lesson/presence-control-block-lesson.component.ts @@ -33,7 +33,7 @@ export class PresenceControlBlockLessonComponent implements OnInit { isCurrentLesson(option: BlockLessonOption): boolean { return isEqual( option.entry.lessonPresence.LessonDateTimeFrom, - this.entry.lessonPresence.LessonDateTimeFrom + this.entry.lessonPresence.LessonDateTimeFrom, ); } diff --git a/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.spec.ts b/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.spec.ts index 78367196f..3f54e1d9a 100644 --- a/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.spec.ts +++ b/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.spec.ts @@ -16,7 +16,7 @@ describe('PresenceControlEntryComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [PresenceControlEntryComponent], - }) + }), ).compileComponents(); })); @@ -39,10 +39,10 @@ function buildPresenceControlEntry(): PresenceControlEntry { new Date(2019, 1, 1, 15, 0), new Date(2019, 1, 1, 16, 0), 'Physik', - 'Marie Curie' + 'Marie Curie', ), null, - null + null, ); Object.defineProperty(presenceControlEntry, 'settings', { diff --git a/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.ts b/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.ts index f1002bd17..89fd0165e 100644 --- a/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.ts +++ b/src/app/presence-control/components/presence-control-entry/presence-control-entry.component.ts @@ -38,19 +38,19 @@ export class PresenceControlEntryComponent implements OnChanges { entry$ = new ReplaySubject(1); studentId$ = this.entry$.pipe( - map(({ lessonPresence }) => lessonPresence.StudentRef.Id) + map(({ lessonPresence }) => lessonPresence.StudentRef.Id), ); loading$ = this.entry$.pipe( switchMap((entry) => - this.loadingService.loading(getBlockLessonLoadingContext(entry)) - ) + this.loadingService.loading(getBlockLessonLoadingContext(entry)), + ), ); constructor( private toastService: ToastService, private translate: TranslateService, private modalService: NgbModal, - private loadingService: LoadingService + private loadingService: LoadingService, ) {} ngOnChanges(changes: SimpleChanges): void { @@ -66,7 +66,7 @@ export class PresenceControlEntryComponent implements OnChanges { updatePresenceType(entry: PresenceControlEntry): void { if (!entry.canChangePresenceType) { this.toastService.warning( - this.translate.instant('presence-control.entry.update-warning') + this.translate.instant('presence-control.entry.update-warning'), ); } else { this.togglePresenceType.emit(entry); @@ -81,7 +81,7 @@ export class PresenceControlEntryComponent implements OnChanges { showPrecedingAbsences(entry: PresenceControlEntry): void { const modalRef = this.modalService.open( - PresenceControlPrecedingAbsenceComponent + PresenceControlPrecedingAbsenceComponent, ); modalRef.componentInstance.precedingAbsences = entry.precedingAbsences; } diff --git a/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.spec.ts b/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.spec.ts index e89438aa5..b2d4449b8 100644 --- a/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.spec.ts +++ b/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.spec.ts @@ -17,7 +17,7 @@ describe('PresenceControlGroupDialogComponent', () => { buildTestModuleMetadata({ declarations: [PresenceControlGroupDialogComponent], providers: [NgbActiveModal], - }) + }), ).compileComponents(); }); diff --git a/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.ts b/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.ts index e965bee25..273dc2c5e 100644 --- a/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.ts +++ b/src/app/presence-control/components/presence-control-group-dialog/presence-control-group-dialog.component.ts @@ -29,7 +29,7 @@ export class PresenceControlGroupDialogComponent implements OnInit { constructor( public activeModal: NgbActiveModal, - private translate: TranslateService + private translate: TranslateService, ) {} ngOnInit(): void { @@ -38,7 +38,7 @@ export class PresenceControlGroupDialogComponent implements OnInit { const emptyOption = this.createEmtpyOption(); this.groupOptions = this.createGroupOptions( - this.subscriptionDetailsDefinitions + this.subscriptionDetailsDefinitions, ); this.groupOptions.unshift(emptyOption); diff --git a/src/app/presence-control/components/presence-control-group/presence-control-group.component.spec.ts b/src/app/presence-control/components/presence-control-group/presence-control-group.component.spec.ts index 825c4d74b..786f59671 100644 --- a/src/app/presence-control/components/presence-control-group/presence-control-group.component.spec.ts +++ b/src/app/presence-control/components/presence-control-group/presence-control-group.component.spec.ts @@ -14,7 +14,7 @@ describe('PresenceControlGroupComponent', () => { buildTestModuleMetadata({ declarations: [PresenceControlGroupComponent], providers: [PresenceControlStateService, PresenceControlGroupService], - }) + }), ).compileComponents(); }); diff --git a/src/app/presence-control/components/presence-control-group/presence-control-group.component.ts b/src/app/presence-control/components/presence-control-group/presence-control-group.component.ts index 1c4b92242..8f0720e09 100644 --- a/src/app/presence-control/components/presence-control-group/presence-control-group.component.ts +++ b/src/app/presence-control/components/presence-control-group/presence-control-group.component.ts @@ -39,11 +39,11 @@ export interface SortCriteria { export class PresenceControlGroupComponent implements OnInit { backlinkQueryParams$ = this.route.queryParams.pipe( map(({ returnparams }) => returnparams), - map(parseQueryString) + map(parseQueryString), ); private eventIds$ = this.state.selectedLesson$.pipe( - map((lesson) => lesson?.getEventIds() || []) + map((lesson) => lesson?.getEventIds() || []), ); private sortCriteriaSubject$ = new BehaviorSubject({ @@ -68,12 +68,12 @@ export class PresenceControlGroupComponent implements OnInit { private subscriptionDetailService: SubscriptionDetailsRestService, private toastService: ToastService, private translate: TranslateService, - private modalService: NgbModal + private modalService: NgbModal, ) {} ngOnInit(): void { this.selectionService.selection$.subscribe( - (selected) => (this.selected = selected as SubscriptionDetailWithName[]) + (selected) => (this.selected = selected as SubscriptionDetailWithName[]), ); } @@ -87,7 +87,7 @@ export class PresenceControlGroupComponent implements OnInit { private openGroupModal( dialogMode: DialogMode, - callback: (selectedGroup: GroupOptions) => void + callback: (selectedGroup: GroupOptions) => void, ): void { combineLatest([ this.groupService.getSubscriptionDetailsDefinitions(), @@ -96,7 +96,7 @@ export class PresenceControlGroupComponent implements OnInit { .pipe(take(1)) .subscribe(([subscriptionDetailsDefinitions, group]) => { const modalRef = this.modalService.open( - PresenceControlGroupDialogComponent + PresenceControlGroupDialogComponent, ); modalRef.componentInstance.dialogMode = dialogMode; modalRef.componentInstance.subscriptionDetailsDefinitions = @@ -107,7 +107,7 @@ export class PresenceControlGroupComponent implements OnInit { (selectedGroup) => { callback(selectedGroup); }, - () => {} + () => {}, ); }); } @@ -121,10 +121,14 @@ export class PresenceControlGroupComponent implements OnInit { take(1), switchMap(([eventIds, savedGroupViews]) => this.userSettings.savePresenceControlGroupView( - updateGroupViewSettings(selectedGroup.id, eventIds, savedGroupViews) - ) + updateGroupViewSettings( + selectedGroup.id, + eventIds, + savedGroupViews, + ), + ), ), - map(() => selectedGroup.id) + map(() => selectedGroup.id), ) .subscribe((groupId) => this.groupService.selectGroup(groupId)); } @@ -132,8 +136,8 @@ export class PresenceControlGroupComponent implements OnInit { private assignCallback(selectedGroup: GroupOptions): void { forkJoin( this.selected.map((s) => - this.subscriptionDetailService.update(selectedGroup.id, s.detail) - ) + this.subscriptionDetailService.update(selectedGroup.id, s.detail), + ), ).subscribe(this.onSaveSuccess.bind(this)); } @@ -143,14 +147,14 @@ export class PresenceControlGroupComponent implements OnInit { this.toastService.success( this.translate.instant( - 'presence-control.groups.notifications.save-success' - ) + 'presence-control.groups.notifications.save-success', + ), ); } getSortDirectionCharacter( sortCriteria: SortCriteria, - sortKey: PrimarySortKey + sortKey: PrimarySortKey, ): string { if (sortCriteria.primarySortKey !== sortKey) { return ''; diff --git a/src/app/presence-control/components/presence-control-header/presence-control-header.component.spec.ts b/src/app/presence-control/components/presence-control-header/presence-control-header.component.spec.ts index fc092b1be..4339e3fe6 100644 --- a/src/app/presence-control/components/presence-control-header/presence-control-header.component.spec.ts +++ b/src/app/presence-control/components/presence-control-header/presence-control-header.component.spec.ts @@ -16,7 +16,7 @@ describe('PresenceControlHeaderComponent', () => { buildTestModuleMetadata({ declarations: [PresenceControlHeaderComponent], providers: [PresenceControlStateService, PresenceControlGroupService], - }) + }), ).compileComponents(); })); diff --git a/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.spec.ts b/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.spec.ts index e7a347d2c..7e06dd61d 100644 --- a/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.spec.ts +++ b/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.spec.ts @@ -13,7 +13,7 @@ describe('PresenceControlIncidentComponent', () => { buildTestModuleMetadata({ declarations: [PresenceControlIncidentComponent], providers: [NgbActiveModal], - }) + }), ).compileComponents(); })); diff --git a/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.ts b/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.ts index 41f8cd3f9..0d49fd2fd 100644 --- a/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.ts +++ b/src/app/presence-control/components/presence-control-incident/presence-control-incident.component.ts @@ -21,14 +21,14 @@ export class PresenceControlIncidentComponent implements OnInit { constructor( public activeModal: NgbActiveModal, - private translate: TranslateService + private translate: TranslateService, ) {} ngOnInit(): void { const emptyOption = this.createIncidentOption(); this.incidentOptions = this.incidentTypes.map((incidentType) => - this.createIncidentOption(incidentType) + this.createIncidentOption(incidentType), ); this.incidentOptions.unshift(emptyOption); diff --git a/src/app/presence-control/components/presence-control-list/presence-control-list.component.spec.ts b/src/app/presence-control/components/presence-control-list/presence-control-list.component.spec.ts index af26d3cba..a50b77180 100644 --- a/src/app/presence-control/components/presence-control-list/presence-control-list.component.spec.ts +++ b/src/app/presence-control/components/presence-control-list/presence-control-list.component.spec.ts @@ -43,7 +43,7 @@ describe('PresenceControlListComponent', () => { new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - 'Dora Durrer' + 'Dora Durrer', ); bichsel = buildPresenceControlEntry('Bichsel Peter'); frisch = buildPresenceControlEntry('Frisch Max'); @@ -62,7 +62,7 @@ describe('PresenceControlListComponent', () => { 'Deutsch', 'Einstein Albert', 'Dora Durrer', - absence.Id + absence.Id, ); stateServiceMock = { @@ -89,7 +89,7 @@ describe('PresenceControlListComponent', () => { blockLessonServiceMock = jasmine.createSpyObj( 'PresenceControlBlockLessonService', - ['getBlockLessonPresenceControlEntries'] + ['getBlockLessonPresenceControlEntries'], ); lessonPresencesUpdateServiceMock = { @@ -117,7 +117,7 @@ describe('PresenceControlListComponent', () => { useValue: lessonPresencesUpdateServiceMock, }, ], - }) + }), ).compileComponents(); })); @@ -157,7 +157,7 @@ describe('PresenceControlListComponent', () => { describe('.doTogglePresenceType', () => { beforeEach(() => { blockLessonServiceMock.getBlockLessonPresenceControlEntries.and.returnValue( - of([bichsel]) + of([bichsel]), ); }); @@ -165,14 +165,14 @@ describe('PresenceControlListComponent', () => { bichsel.lessonPresence = lessonPresence; component.togglePresenceType(bichsel); expect( - lessonPresencesUpdateServiceMock.updatePresenceType + lessonPresencesUpdateServiceMock.updatePresenceType, ).toHaveBeenCalledWith(bichsel, absence.Id); }); it('updates given entry to next presence type', () => { component.doTogglePresenceType([bichsel]); expect( - lessonPresencesUpdateServiceMock.updatePresenceType + lessonPresencesUpdateServiceMock.updatePresenceType, ).toHaveBeenCalledWith(bichsel, absence.Id); }); }); @@ -184,7 +184,7 @@ describe('PresenceControlListComponent', () => { } function buildPresenceControlEntry( - studentName: string + studentName: string, ): PresenceControlEntry { const presenceControlEntry = new PresenceControlEntry( buildLessonPresence( @@ -192,10 +192,10 @@ describe('PresenceControlListComponent', () => { lesson.LessonDateTimeFrom, lesson.LessonDateTimeTo, lesson.EventDesignation, - studentName + studentName, ), null, - null + null, ); Object.defineProperty(presenceControlEntry, 'settings', { diff --git a/src/app/presence-control/components/presence-control-list/presence-control-list.component.ts b/src/app/presence-control/components/presence-control-list/presence-control-list.component.ts index 28b0cb166..85c6bb571 100644 --- a/src/app/presence-control/components/presence-control-list/presence-control-list.component.ts +++ b/src/app/presence-control/components/presence-control-list/presence-control-list.component.ts @@ -49,7 +49,7 @@ export class PresenceControlListComponent private presenceTypesService: PresenceTypesService, private modalService: NgbModal, private scrollPosition: ScrollPositionService, - private route: ActivatedRoute + private route: ActivatedRoute, ) {} ngOnInit(): void { @@ -73,9 +73,9 @@ export class PresenceControlListComponent .subscribe((newPresenceType) => this.lessonPresencesUpdateService.updatePresenceType( entry, - newPresenceType ? newPresenceType.Id : null - ) - ) + newPresenceType ? newPresenceType.Id : null, + ), + ), ); } @@ -94,7 +94,7 @@ export class PresenceControlListComponent this.doTogglePresenceType([refetchedEntry]); } else { const modalRef = this.modalService.open( - PresenceControlBlockLessonComponent + PresenceControlBlockLessonComponent, ); modalRef.componentInstance.entry = entry; modalRef.componentInstance.blockPresenceControlEntries = @@ -105,10 +105,10 @@ export class PresenceControlListComponent this.doTogglePresenceType(entries); } }, - () => {} + () => {}, ); } - } + }, ); } @@ -127,7 +127,7 @@ export class PresenceControlListComponent (selectedIncident) => { this.updateIncident(entry, selectedIncident?.Id || null); }, - () => {} + () => {}, ); }); } diff --git a/src/app/presence-control/components/presence-control-preceding-absence/presence-control-preceding-absence.component.spec.ts b/src/app/presence-control/components/presence-control-preceding-absence/presence-control-preceding-absence.component.spec.ts index 0adb5c488..1b096d1f1 100644 --- a/src/app/presence-control/components/presence-control-preceding-absence/presence-control-preceding-absence.component.spec.ts +++ b/src/app/presence-control/components/presence-control-preceding-absence/presence-control-preceding-absence.component.spec.ts @@ -13,7 +13,7 @@ describe('PresenceControlPreviousAbsenceComponent', () => { buildTestModuleMetadata({ declarations: [PresenceControlPrecedingAbsenceComponent], providers: [NgbActiveModal], - }) + }), ).compileComponents(); }); diff --git a/src/app/presence-control/components/presence-control/presence-control.component.spec.ts b/src/app/presence-control/components/presence-control/presence-control.component.spec.ts index b06d0db75..744a5198f 100644 --- a/src/app/presence-control/components/presence-control/presence-control.component.spec.ts +++ b/src/app/presence-control/components/presence-control/presence-control.component.spec.ts @@ -11,7 +11,7 @@ describe('PresenceControlComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [PresenceControlComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/presence-control/components/presence-control/presence-control.component.ts b/src/app/presence-control/components/presence-control/presence-control.component.ts index 29d08aa31..81656af1e 100644 --- a/src/app/presence-control/components/presence-control/presence-control.component.ts +++ b/src/app/presence-control/components/presence-control/presence-control.component.ts @@ -33,7 +33,7 @@ export class PresenceControlComponent implements OnInit, OnDestroy { constructor( private state: PresenceControlStateService, - private lessonPresencesUpdateService: LessonPresencesUpdateService + private lessonPresencesUpdateService: LessonPresencesUpdateService, ) {} ngOnInit(): void { diff --git a/src/app/presence-control/models/lesson-entry.model.ts b/src/app/presence-control/models/lesson-entry.model.ts index 148a476e9..f0d0f1b21 100644 --- a/src/app/presence-control/models/lesson-entry.model.ts +++ b/src/app/presence-control/models/lesson-entry.model.ts @@ -4,7 +4,7 @@ import { lessonsEqual } from '../utils/lessons'; export function lessonsEntryEqual( a: Option, - b: Option + b: Option, ): boolean { return ( (a === null && b === null) || @@ -20,7 +20,7 @@ export function fromLesson(lesson: Lesson): LessonEntry { const entry = new LessonEntry( lesson.TeacherInformation, lesson.LessonDateTimeFrom, - lesson.LessonDateTimeTo + lesson.LessonDateTimeTo, ); entry.addLesson(lesson); return entry; @@ -39,7 +39,7 @@ export class LessonEntry { constructor( public TeacherInformation: string, public LessonDateTimeFrom: Date, - public LessonDateTimeTo: Date + public LessonDateTimeTo: Date, ) {} addLesson(lesson: Lesson): void { @@ -70,7 +70,7 @@ export class LessonEntry { ...new Set( this.lessons .map((l) => l.StudyClassNumber) - .sort((a, b) => a.localeCompare(b)) + .sort((a, b) => a.localeCompare(b)), ), ].join(', '); } diff --git a/src/app/presence-control/models/presence-control-entry.model.spec.ts b/src/app/presence-control/models/presence-control-entry.model.spec.ts index e09eda4ea..26cb30ee8 100644 --- a/src/app/presence-control/models/presence-control-entry.model.spec.ts +++ b/src/app/presence-control/models/presence-control-entry.model.spec.ts @@ -110,7 +110,7 @@ describe('PresenceControlEntry', () => { }); function buildPresenceControlEntry( - presenceType: Option + presenceType: Option, ): PresenceControlEntry { const presenceControlEntry = new PresenceControlEntry( buildLessonPresence( @@ -120,10 +120,10 @@ describe('PresenceControlEntry', () => { 'Math', 'Einstein Albert', 'Martina Moser', - presenceType ? presenceType.Id : undefined + presenceType ? presenceType.Id : undefined, ), presenceType, - null + null, ); Object.defineProperty(presenceControlEntry, 'settings', { diff --git a/src/app/presence-control/models/presence-control-entry.model.ts b/src/app/presence-control/models/presence-control-entry.model.ts index 517f95668..483820599 100644 --- a/src/app/presence-control/models/presence-control-entry.model.ts +++ b/src/app/presence-control/models/presence-control-entry.model.ts @@ -37,7 +37,7 @@ export class PresenceControlEntry implements Searchable { public lessonPresence: LessonPresence, public presenceType: Option, public precedingAbsences: Option>, - public confirmationState?: DropDownItem + public confirmationState?: DropDownItem, ) { this.studentFullName = lessonPresence.StudentFullName; } @@ -46,7 +46,7 @@ export class PresenceControlEntry implements Searchable { if ( isUnapprovedAbsence( this.settings, - this.confirmationState && Number(this.confirmationState.Key) + this.confirmationState && Number(this.confirmationState.Key), ) ) { return PresenceCategory.Unapproved; @@ -66,14 +66,14 @@ export class PresenceControlEntry implements Searchable { } getNextPresenceType( - presenceTypes: ReadonlyArray + presenceTypes: ReadonlyArray, ): Option { switch (this.nextPresenceCategory) { case PresenceCategory.Absent: return this.presenceCategory === PresenceCategory.Unapproved ? this.presenceType : presenceTypes.find((type) => - isDefaultAbsence(type, this.settings) + isDefaultAbsence(type, this.settings), ) || null; default: return null; @@ -84,7 +84,7 @@ export class PresenceControlEntry implements Searchable { return canChangePresenceType( this.lessonPresence, this.presenceType, - this.settings + this.settings, ); } diff --git a/src/app/presence-control/services/presence-control-block-lesson.service.ts b/src/app/presence-control/services/presence-control-block-lesson.service.ts index 157f20ca2..2b11d0c33 100644 --- a/src/app/presence-control/services/presence-control-block-lesson.service.ts +++ b/src/app/presence-control/services/presence-control-block-lesson.service.ts @@ -12,7 +12,7 @@ import { LoadingService } from 'src/app/shared/services/loading-service'; const MAX_BLOCK_LESSION_MINUTES_GAP = 30; export function getBlockLessonLoadingContext( - entry: PresenceControlEntry + entry: PresenceControlEntry, ): string { return `blockLesson${entry.lessonPresence.Id}`; } @@ -23,7 +23,7 @@ export class PresenceControlBlockLessonService { private state: PresenceControlStateService, private lessonPresencesService: LessonPresencesRestService, private loadingService: LoadingService, - @Inject(SETTINGS) private settings: Settings + @Inject(SETTINGS) private settings: Settings, ) {} /** @@ -36,7 +36,7 @@ export class PresenceControlBlockLessonService { * for which the presence type cannot be updated. */ getBlockLessonPresenceControlEntries( - entry: PresenceControlEntry + entry: PresenceControlEntry, ): Observable> { return combineLatest([ this.state.lessons$.pipe(take(1)), @@ -57,16 +57,16 @@ export class PresenceControlBlockLessonService { (presence) => getPresenceControlEntry( lessons.find( - (lesson) => lesson.id === presence.LessonRef.Id.toString() + (lesson) => lesson.id === presence.LessonRef.Id.toString(), ), presence, types, confirmationStates, - otherTeachersAbsences - ) + otherTeachersAbsences, + ), ); - } - ) + }, + ), ); } @@ -75,7 +75,7 @@ export class PresenceControlBlockLessonService { */ private filterBlockLessonPresences( entry: PresenceControlEntry, - lessonPresences: ReadonlyArray + lessonPresences: ReadonlyArray, ): ReadonlyArray { return [...lessonPresences] .sort((a, b) => (a.LessonDateTimeFrom > b.LessonDateTimeFrom ? 1 : -1)) @@ -97,7 +97,7 @@ export class PresenceControlBlockLessonService { */ private isWithinBlockTime( presence: LessonPresence, - previousPresence: LessonPresence + previousPresence: LessonPresence, ): boolean { if (!previousPresence) { return true; @@ -114,7 +114,7 @@ export class PresenceControlBlockLessonService { * Returns the changeable lesson presences, relevant to determine block lessons. */ private loadChangeableLessonPresences( - entry: PresenceControlEntry + entry: PresenceControlEntry, ): Observable> { return combineLatest([ // To determine the block lessons, it is important to fetch all @@ -128,10 +128,10 @@ export class PresenceControlBlockLessonService { canChangePresenceType( presence, types.find((t) => t.Id === presence.TypeRef.Id) || null, - this.settings - ) - ) - ) + this.settings, + ), + ), + ), ); } @@ -139,25 +139,25 @@ export class PresenceControlBlockLessonService { * Returns all lesson presences of same day/student/teacher/class. */ private loadLessonPresences( - entry: PresenceControlEntry + entry: PresenceControlEntry, ): Observable> { return this.loadingService.load( this.lessonPresencesService .getListByDateStudentClass( entry.lessonPresence.LessonDateTimeFrom, entry.lessonPresence.StudentRef.Id, - entry.lessonPresence.StudyClassRef.Id ?? undefined + entry.lessonPresence.StudyClassRef.Id ?? undefined, ) .pipe( map((presences) => presences.filter( (presence) => presence.TeacherInformation === - entry.lessonPresence.TeacherInformation - ) - ) + entry.lessonPresence.TeacherInformation, + ), + ), ), - getBlockLessonLoadingContext(entry) + getBlockLessonLoadingContext(entry), ); } } diff --git a/src/app/presence-control/services/presence-control-state.service.ts b/src/app/presence-control/services/presence-control-state.service.ts index 171dfbfd9..b1b365313 100644 --- a/src/app/presence-control/services/presence-control-state.service.ts +++ b/src/app/presence-control/services/presence-control-state.service.ts @@ -57,7 +57,7 @@ import { } from 'src/app/shared/utils/observable'; export const VIEW_MODES: ReadonlyArray = Object.values( - PresenceControlViewMode + PresenceControlViewMode, ); @Injectable() @@ -74,49 +74,49 @@ export class PresenceControlStateService private viewModeSubject$ = new Subject(); viewMode$ = merge( this.viewModeSubject$, - this.userSettings.getPresenceControlViewMode().pipe(take(1)) + this.userSettings.getPresenceControlViewMode().pipe(take(1)), ); lessons$ = this.selectedDate$.pipe( switchMap((date) => this.loadLessonsByDate(date)), - shareReplay(1) + shareReplay(1), ); private selectLessonId$ = new Subject(); private selectLesson$ = this.selectLessonId$.pipe( - switchMap((id) => this.getLessonById(id)) + switchMap((id) => this.getLessonById(id)), ); selectedLesson$ = combineLatest([ reemitOnTrigger( this.selectLesson$.pipe(distinctUntilChanged((a, b) => isEqual(a, b))), - intervalOnInactivity(this.settings.lessonPresencesRefreshTime) // Trigger lesson reloading after periods of inactivity + intervalOnInactivity(this.settings.lessonPresencesRefreshTime), // Trigger lesson reloading after periods of inactivity ), this.lessons$, ]).pipe( map(([selectedLesson, lessons]) => // Reset selection if day changed - lessons.find((l) => l.id === selectedLesson.id) ? selectedLesson : null + lessons.find((l) => l.id === selectedLesson.id) ? selectedLesson : null, ), - shareReplay(1) + shareReplay(1), ); private updateLessonPresences$ = new Subject>(); private lessonPresences$ = merge( this.selectedLesson$.pipe( switchMap((lesson) => - lesson ? this.loadLessonPresencesByLesson(lesson) : of([]) - ) + lesson ? this.loadLessonPresencesByLesson(lesson) : of([]), + ), ), - this.updateLessonPresences$ + this.updateLessonPresences$, ).pipe(shareReplay(1)); presenceTypes$ = this.loadPresenceTypes().pipe(shareReplay(1)); studentIdsWithUnconfirmedAbsences$ = reemitOnTrigger( this.selectedDate$, - this.selectedLesson$.pipe(skip(1)) + this.selectedLesson$.pipe(skip(1)), ).pipe( switchMap(() => this.loadStudentIdsWithUnconfirmedAbsences()), - shareReplay(1) + shareReplay(1), ); loading$ = this.loadingService.loading$; @@ -127,7 +127,7 @@ export class PresenceControlStateService private studentIds$ = this.lessonPresences$.pipe( map((p) => uniq(p.map((i) => i.StudentRef.Id))), - shareReplay(1) + shareReplay(1), ); otherTeachersAbsences$ = this.studentIds$.pipe( @@ -136,11 +136,11 @@ export class PresenceControlStateService studentIds.length > 0 ? this.lessonTeacherService.loadOtherTeachersLessonAbsences( this.getMyself(), - studentIds + studentIds, ) - : of([]) + : of([]), ), - shareReplay(1) + shareReplay(1), ); groupsAvailability$ = this.groupService.groupsAvailability$; @@ -160,16 +160,16 @@ export class PresenceControlStateService ]).pipe(map(spread(filterByGroup)), shareReplay(1)); presentCount$ = this.presenceControlEntriesByGroup$.pipe( - map(getCategoryCount('present')) + map(getCategoryCount('present')), ); absentCount$ = this.presenceControlEntriesByGroup$.pipe( - map(getCategoryCount('absent')) + map(getCategoryCount('absent')), ); unapprovedCount$ = this.presenceControlEntriesByGroup$.pipe( - map(getCategoryCount('unapproved')) + map(getCategoryCount('unapproved')), ); absentPrecedingCount$ = this.presenceControlEntriesByGroup$.pipe( - map(getPrecedingAbsencesCount()) + map(getPrecedingAbsencesCount()), ); queryParamsString$ = combineLatest([ @@ -190,7 +190,7 @@ export class PresenceControlStateService private loadingService: LoadingService, private storageService: StorageService, @Inject(SETTINGS) private settings: Settings, - private location: Location + private location: Location, ) { this.queryParamsString$ .pipe(takeUntil(this.destroy$)) @@ -203,7 +203,7 @@ export class PresenceControlStateService .pipe( skip(1), // Only save the view mode setting when changed by user, not on initial loading switchMap((v) => this.userSettings.savePresenceControlViewMode(v)), - takeUntil(this.destroy$) + takeUntil(this.destroy$), ) .subscribe(); @@ -214,7 +214,7 @@ export class PresenceControlStateService this.lessonPresences$ .pipe(takeUntil(this.destroy$)) .subscribe((presences) => - this.groupService.setLessonPresences(presences) + this.groupService.setLessonPresences(presences), ); } @@ -235,7 +235,7 @@ export class PresenceControlStateService } updateLessonPresencesTypes( - updates: ReadonlyArray + updates: ReadonlyArray, ): void { combineLatest([ this.lessonPresences$.pipe(take(1)), @@ -247,40 +247,40 @@ export class PresenceControlStateService lessonPresences, updates, presenceTypes, - this.settings - ) - ) + this.settings, + ), + ), ) .subscribe((lessonPresences) => - this.updateLessonPresences$.next(lessonPresences) + this.updateLessonPresences$.next(lessonPresences), ); } getNextPresenceType( - entry: PresenceControlEntry + entry: PresenceControlEntry, ): Observable> { return this.presenceTypes$.pipe( take(1), - map((presenceTypes) => entry.getNextPresenceType(presenceTypes)) + map((presenceTypes) => entry.getNextPresenceType(presenceTypes)), ); } hasUnconfirmedAbsences(entry: PresenceControlEntry): Observable { return this.studentIdsWithUnconfirmedAbsences$.pipe( - map((ids) => ids.includes(entry.lessonPresence.StudentRef.Id)) + map((ids) => ids.includes(entry.lessonPresence.StudentRef.Id)), ); } private loadLessonPresencesByLesson( - lesson: LessonEntry + lesson: LessonEntry, ): Observable> { return this.loadingService.load( - this.lessonPresencesService.getListByLessons(lesson.lessons) + this.lessonPresencesService.getListByLessons(lesson.lessons), ); } private loadLessonsByDate( - date: Date + date: Date, ): Observable> { return this.loadingService .load(this.lessonPresencesService.getLessonsByDate(date)) @@ -302,17 +302,17 @@ export class PresenceControlStateService 0, // Only start polling if a refresh time is defined // with rxjs 7.5 it's not possible to pass undefined - according to the documentation negative numbers means the same as not passing an intervalduration at all - this.settings.unconfirmedAbsencesRefreshTime || -1 + this.settings.unconfirmedAbsencesRefreshTime || -1, ).pipe( switchMap(() => this.lessonPresencesService.getListOfUnconfirmed()), - map((unconfirmed) => uniq(unconfirmed.map((p) => p.StudentRef.Id))) + map((unconfirmed) => uniq(unconfirmed.map((p) => p.StudentRef.Id))), ); } private buildQueryParams( date: Date, lessonEntry: Option, - viewMode: PresenceControlViewMode + viewMode: PresenceControlViewMode, ): Params { const params: Params = { date: format(date, 'yyyy-MM-dd'), @@ -332,9 +332,9 @@ export class PresenceControlStateService // Use lesson from id if available (id && lessons.find((l) => l.id === id)) || // Or fallback to currently ongoing lesson as default - getCurrentLessonEntry(lessons) + getCurrentLessonEntry(lessons), ), - filter(Boolean) + filter(Boolean), ); } diff --git a/src/app/presence-control/utils/lesson-entries.spec.ts b/src/app/presence-control/utils/lesson-entries.spec.ts index eee48c813..6fe28e4f1 100644 --- a/src/app/presence-control/utils/lesson-entries.spec.ts +++ b/src/app/presence-control/utils/lesson-entries.spec.ts @@ -15,7 +15,7 @@ describe('lessons entries', () => { new Date(2000, 0, 23, 10, 0), 'Mathematik', 'Hans Lüdi', - '9a' + '9a', ); const lesson2 = buildLesson( 2, @@ -23,7 +23,7 @@ describe('lessons entries', () => { new Date(2000, 0, 23, 9, 0), 'Deutsch', 'Hans Lüdi', - '9a' + '9a', ); const lesson3 = buildLesson( 3, @@ -31,7 +31,7 @@ describe('lessons entries', () => { new Date(2000, 0, 23, 9, 0), 'Deutsch', 'Hans Lüdi', - '9b' + '9b', ); const lesson4 = buildLesson( 4, @@ -39,7 +39,7 @@ describe('lessons entries', () => { new Date(2000, 0, 23, 9, 0), 'Deutsch', 'Christine Flückiger', - '9c' + '9c', ); const result = getLessonEntriesForLessons([ lesson1, @@ -74,28 +74,28 @@ describe('lessons entries', () => { new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - `Dora Durrer` + `Dora Durrer`, ); math = buildLesson( 2, new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); singen = buildLesson( 3, new Date(2000, 0, 23, 11, 0), new Date(2000, 0, 23, 12, 0), 'Singen', - 'Sandra Schmid' + 'Sandra Schmid', ); werken = buildLesson( 4, new Date(2000, 0, 23, 13, 0), new Date(2000, 0, 23, 14, 0), 'Werken', - 'Wanda Wehrli' + 'Wanda Wehrli', ); lessons = [ diff --git a/src/app/presence-control/utils/lesson-entries.ts b/src/app/presence-control/utils/lesson-entries.ts index 6825d5df6..632adb171 100644 --- a/src/app/presence-control/utils/lesson-entries.ts +++ b/src/app/presence-control/utils/lesson-entries.ts @@ -11,7 +11,7 @@ import { Lesson } from 'src/app/shared/models/lesson.model'; * Returns a sorted array of lesson entries for the given lesson presences. */ export function getLessonEntriesForLessons( - lessons: ReadonlyArray + lessons: ReadonlyArray, ): Array { return uniqueLessons(lessons) .reduce((entries, lesson) => { @@ -35,7 +35,7 @@ export function getLessonEntriesForLessons( * before or after today) it returns the first lesson. */ export function getCurrentLessonEntry( - lessons: ReadonlyArray + lessons: ReadonlyArray, ): Option { if (lessons.length === 0) { return null; diff --git a/src/app/presence-control/utils/lesson-presences.spec.ts b/src/app/presence-control/utils/lesson-presences.spec.ts index 5f4a59f5c..38e93b658 100644 --- a/src/app/presence-control/utils/lesson-presences.spec.ts +++ b/src/app/presence-control/utils/lesson-presences.spec.ts @@ -38,7 +38,7 @@ describe('lesson presences utils', () => { new Date(2000, 0, 23, 7, 0), new Date(2000, 0, 23, 8, 0), 'Turnen', - 'Frisch Max' + 'Frisch Max', ); turnenFrisch.StudentRef = buildReference(10); turnenFrisch.TypeRef = { Id: null, HRef: null }; @@ -50,7 +50,7 @@ describe('lesson presences utils', () => { 'Deutsch', 'Einstein Albert', 'Dora Durrer', - absent.Id + absent.Id, ); deutschEinsteinAbwesend.StudentRef = buildReference(20); deutschEinsteinAbwesend.Type = absent.Designation; @@ -61,7 +61,7 @@ describe('lesson presences utils', () => { new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - 'Frisch Max' + 'Frisch Max', ); deutschFrisch.StudentRef = buildReference(10); deutschFrisch.TypeRef = { Id: null, HRef: null }; @@ -73,7 +73,7 @@ describe('lesson presences utils', () => { 'Deutsch', 'Walser Robert', 'Dora Durrer', - comment.Id + comment.Id, ); deutschWalser.StudentRef = buildReference(30); deutschWalser.Type = comment.Designation; @@ -86,7 +86,7 @@ describe('lesson presences utils', () => { 'Deutsch', 'Currie Marie', 'Dora Durrer', - absent.Id + absent.Id, ); deutschCurrieAbwesend.StudentRef = buildReference(40); deutschCurrieAbwesend.Type = absent.Designation; @@ -112,7 +112,7 @@ describe('lesson presences utils', () => { { presence: deutschCurrieAbwesend, newPresenceTypeId: null }, ], presenceTypes, - settings + settings, ); expect(result.length).toBe(5); diff --git a/src/app/presence-control/utils/lessons.spec.ts b/src/app/presence-control/utils/lessons.spec.ts index 5f524c83d..f470dd131 100644 --- a/src/app/presence-control/utils/lessons.spec.ts +++ b/src/app/presence-control/utils/lessons.spec.ts @@ -25,7 +25,7 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); expect(lessonsEqual(null, lesson)).toBe(false); expect(lessonsEqual(lesson, null)).toBe(false); @@ -37,7 +37,7 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); expect(lessonsEqual(lesson, lesson)).toBe(true); }); @@ -48,14 +48,14 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); const lesson2 = buildLesson( 1, new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); expect(lessonsEqual(lesson1, lesson2)).toBe(true); }); @@ -66,14 +66,14 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); const lesson2 = buildLesson( 2, new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Deutsch', - `Dora Durrer` + `Dora Durrer`, ); expect(lessonsEqual(lesson1, lesson2)).toBe(false); }); @@ -84,14 +84,14 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); const lesson2 = buildLesson( 2, new Date(2000, 0, 23, 10, 0), new Date(2000, 0, 23, 11, 0), 'Mathematik', - `Monika Muster` + `Monika Muster`, ); expect(lessonsEqual(lesson1, lesson2)).toBe(false); }); @@ -104,8 +104,8 @@ describe('lessons utils', () => { 1, new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), - 'Mathematik' - ) + 'Mathematik', + ), ); expect(result).toEqual({ LessonRef: { Id: 1, HRef: '/1' }, @@ -130,8 +130,8 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - 'Dora Durrer' - ) + 'Dora Durrer', + ), ), [ buildLessonPresence( @@ -139,30 +139,30 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - 'Max Frisch' + 'Max Frisch', ), buildLessonPresence( 2, new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - 'Einstein Albert' + 'Einstein Albert', ), buildLessonPresence( 1, new Date(2000, 0, 23, 9, 0), new Date(2000, 0, 23, 10, 0), 'Mathematik', - 'Einstein Albert' + 'Einstein Albert', ), buildLessonPresence( 3, new Date(2000, 0, 23, 10, 0), new Date(2000, 0, 23, 11, 0), 'Mathematik', - 'Einstein Albert' + 'Einstein Albert', ), - ] + ], ); expect(result.length).toEqual(2); expect(result.map((p) => p.StudentFullName)).toEqual([ @@ -178,7 +178,7 @@ describe('lessons utils', () => { new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - 'Max Frisch' + 'Max Frisch', ), ]); expect(result).toEqual([]); diff --git a/src/app/presence-control/utils/lessons.ts b/src/app/presence-control/utils/lessons.ts index 5b275995c..18721fb56 100644 --- a/src/app/presence-control/utils/lessons.ts +++ b/src/app/presence-control/utils/lessons.ts @@ -9,7 +9,7 @@ import { uniqBy } from 'lodash-es'; export function lessonsEqual( a: Option, - b: Option + b: Option, ): boolean { return ( (a === null && b === null) || @@ -45,7 +45,7 @@ export function extractLesson(lessonPresence: LessonPresence): Lesson { */ export function getLessonPresencesForLesson( lessonEntry: Option, - lessonPresences: ReadonlyArray + lessonPresences: ReadonlyArray, ): ReadonlyArray { if (!lessonEntry) { return []; @@ -56,7 +56,7 @@ export function getLessonPresencesForLesson( (p) => lessonEntry.lessons .map((l) => l.LessonRef.Id) - .indexOf(p.LessonRef.Id) >= 0 + .indexOf(p.LessonRef.Id) >= 0, ) .sort(lessonPresencesComparator); } @@ -68,7 +68,7 @@ export function getLessonPresencesForLesson( function getPrecedingAbsences( otherTeachersAbsences: ReadonlyArray, lessonPresence: LessonPresence, - lesson?: Option + lesson?: Option, ): ReadonlyArray { return uniqBy( otherTeachersAbsences.filter( @@ -77,9 +77,9 @@ function getPrecedingAbsences( absence.LessonRef.From && absence.LessonRef.From.toDateString() === lesson?.LessonDateTimeFrom.toDateString() && - absence.LessonRef.From < lesson?.LessonDateTimeFrom + absence.LessonRef.From < lesson?.LessonDateTimeFrom, ), - 'Id' + 'Id', ).sort(lessonAbsenceTimeComparator); } @@ -88,7 +88,7 @@ export function getPresenceControlEntriesForLesson( lessonPresences: ReadonlyArray, presenceTypes: ReadonlyArray, confirmationStates: ReadonlyArray, - otherTeachersAbsences: ReadonlyArray + otherTeachersAbsences: ReadonlyArray, ): ReadonlyArray { return getLessonPresencesForLesson(lesson, lessonPresences).map( (lessonPresence) => @@ -97,8 +97,8 @@ export function getPresenceControlEntriesForLesson( lessonPresence, presenceTypes, confirmationStates, - otherTeachersAbsences - ) + otherTeachersAbsences, + ), ); } @@ -107,7 +107,7 @@ export function getPresenceControlEntry( lessonPresence: LessonPresence, presenceTypes: ReadonlyArray, confirmationStates: ReadonlyArray, - otherTeachersAbsences: ReadonlyArray + otherTeachersAbsences: ReadonlyArray, ): PresenceControlEntry { let presenceType = null; if (lessonPresence.TypeRef.Id) { @@ -118,20 +118,20 @@ export function getPresenceControlEntry( const precedingAbsences = getPrecedingAbsences( otherTeachersAbsences, lessonPresence, - lesson + lesson, ); let confirmationState; if (lessonPresence.ConfirmationStateId) { confirmationState = confirmationStates.find( - (s) => s.Key === lessonPresence.ConfirmationStateId + (s) => s.Key === lessonPresence.ConfirmationStateId, ); } return new PresenceControlEntry( lessonPresence, presenceType, precedingAbsences, - confirmationState + confirmationState, ); } @@ -140,7 +140,7 @@ export function getPresenceControlEntry( */ export function lessonsComparator( a: Lesson | LessonPresence | LessonEntry, - b: Lesson | LessonPresence | LessonEntry + b: Lesson | LessonPresence | LessonEntry, ): number { const aFromTime = a.LessonDateTimeFrom.getTime(); const bFromTime = b.LessonDateTimeFrom.getTime(); @@ -155,7 +155,7 @@ export function lessonsComparator( */ function lessonPresencesComparator( a: LessonPresence, - b: LessonPresence + b: LessonPresence, ): number { return a.StudentFullName.localeCompare(b.StudentFullName); } @@ -165,7 +165,7 @@ function lessonPresencesComparator( */ function lessonAbsenceTimeComparator( a: LessonAbsence, - b: LessonAbsence + b: LessonAbsence, ): number { if ( a.LessonRef.From && diff --git a/src/app/presence-control/utils/presence-control-entries.spec.ts b/src/app/presence-control/utils/presence-control-entries.spec.ts index 645b6d3d7..541364d4f 100644 --- a/src/app/presence-control/utils/presence-control-entries.spec.ts +++ b/src/app/presence-control/utils/presence-control-entries.spec.ts @@ -36,7 +36,7 @@ describe('presence control entries utils', () => { }); function buildPresenceControlEntry( - studentName: string + studentName: string, ): PresenceControlEntry { return new PresenceControlEntry( buildLessonPresence( @@ -44,10 +44,10 @@ describe('presence control entries utils', () => { new Date(2000, 0, 23, 8, 0), new Date(2000, 0, 23, 9, 0), 'Deutsch', - studentName + studentName, ), null, - null + null, ); } }); diff --git a/src/app/presence-control/utils/presence-control-entries.ts b/src/app/presence-control/utils/presence-control-entries.ts index 11adff175..3b40feee6 100644 --- a/src/app/presence-control/utils/presence-control-entries.ts +++ b/src/app/presence-control/utils/presence-control-entries.ts @@ -1,24 +1,24 @@ import { PresenceControlEntry } from '../models/presence-control-entry.model'; export function getCategoryCount( - presenceCategory: string + presenceCategory: string, ): (entries: ReadonlyArray) => number { return (entries) => entries.reduce( (count, entry) => count + (entry.presenceCategory === presenceCategory ? 1 : 0), - 0 + 0, ); } export function getPrecedingAbsencesCount(): ( - entries: ReadonlyArray + entries: ReadonlyArray, ) => number { return (entries) => entries.reduce( (count, entry) => count + (entry.precedingAbsences && entry.precedingAbsences.length > 0 ? 1 : 0), - 0 + 0, ); } diff --git a/src/app/presence-control/utils/presence-types.spec.ts b/src/app/presence-control/utils/presence-types.spec.ts index dca733354..93634aa82 100644 --- a/src/app/presence-control/utils/presence-types.spec.ts +++ b/src/app/presence-control/utils/presence-types.spec.ts @@ -27,7 +27,7 @@ describe('presence types', () => { undefined, undefined, undefined, - settings.unconfirmedAbsenceStateId + settings.unconfirmedAbsenceStateId, ); lessonPresenceUnapproved = buildLessonPresence( @@ -40,7 +40,7 @@ describe('presence types', () => { undefined, undefined, undefined, - settings.checkableAbsenceStateId + settings.checkableAbsenceStateId, ); lessonPresence = buildLessonPresence( @@ -48,13 +48,13 @@ describe('presence types', () => { new Date(2000, 0, 23, 7, 0), new Date(2000, 0, 23, 8, 0), 'Zeichnen', - 'Vincent van Gogh' + 'Vincent van Gogh', ); absenceType = buildPresenceType( settings.absencePresenceTypeId, true, - false + false, ); commentType = buildPresenceType(6, false, false, true); incidentType = buildPresenceType(14, false, true, false); @@ -63,7 +63,7 @@ describe('presence types', () => { describe('.getNewConfirmationStateId', () => { it('should return unconfirmedAbsenceStateId if given absence presence type matches absencePresenceTypeId', () => { expect(getNewConfirmationStateId(absenceType, settings)).toBe( - settings.unconfirmedAbsenceStateId + settings.unconfirmedAbsenceStateId, ); }); @@ -79,31 +79,31 @@ describe('presence types', () => { describe('.canChangePresenceType', () => { it('should return true if is unapproved absence type', () => { expect( - canChangePresenceType(lessonPresenceUnapproved, absenceType, settings) + canChangePresenceType(lessonPresenceUnapproved, absenceType, settings), ).toBeTruthy(); }); it('should return true if is confirmed default absence type', () => { expect( - canChangePresenceType(lessonPresenceConfirmed, absenceType, settings) + canChangePresenceType(lessonPresenceConfirmed, absenceType, settings), ).toBeTruthy(); }); it('should return true if is comment absence type', () => { expect( - canChangePresenceType(lessonPresence, commentType, settings) + canChangePresenceType(lessonPresence, commentType, settings), ).toBeTruthy(); }); it('should return true if absence type is null, e.g. present', () => { expect( - canChangePresenceType(lessonPresence, null, settings) + canChangePresenceType(lessonPresence, null, settings), ).toBeTruthy(); }); it('should return true if is incident type', () => { expect( - canChangePresenceType(lessonPresence, incidentType, settings) + canChangePresenceType(lessonPresence, incidentType, settings), ).toBeTruthy(); }); }); diff --git a/src/app/rest-error-interceptor.spec.ts b/src/app/rest-error-interceptor.spec.ts index 3f081c28b..95b46c217 100644 --- a/src/app/rest-error-interceptor.spec.ts +++ b/src/app/rest-error-interceptor.spec.ts @@ -28,7 +28,7 @@ describe('RestErrorInterceptor', () => { useValue: toastServiceMock, }, ], - }) + }), ); http = TestBed.inject(HttpClient); @@ -182,7 +182,7 @@ describe('RestErrorInterceptor', () => { }, ], }, - { status: 409, statusText: 'Conflict' } + { status: 409, statusText: 'Conflict' }, ); expect(successCallback).not.toHaveBeenCalled(); @@ -190,7 +190,7 @@ describe('RestErrorInterceptor', () => { expect(routerMock.navigate).not.toHaveBeenCalled(); expect(toastServiceMock.error).toHaveBeenCalledWith( 'Person ist bereits angemeldet: Die Anmeldung kann nicht erstellt werden.\nEin weiteres Problem bla bla.', - `global.rest-errors.conflict-title` + `global.rest-errors.conflict-title`, ); }); @@ -258,7 +258,7 @@ describe('RestErrorInterceptor', () => { function expectToast(messageKey: string): void { expect(toastServiceMock.error).toHaveBeenCalledWith( `global.rest-errors.${messageKey}-message`, - `global.rest-errors.${messageKey}-title` + `global.rest-errors.${messageKey}-title`, ); } }); diff --git a/src/app/rest-role-interceptor.spec.ts b/src/app/rest-role-interceptor.spec.ts index a0ef88914..c219c3d6f 100644 --- a/src/app/rest-role-interceptor.spec.ts +++ b/src/app/rest-role-interceptor.spec.ts @@ -17,7 +17,7 @@ describe('RestRoleInterceptor', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ providers: [{ provide: Router, useValue: mockRouter }], - }) + }), ); http = TestBed.inject(HttpClient); @@ -37,7 +37,7 @@ describe('RestRoleInterceptor', () => { httpTestingController .expectOne( (req) => - req.url === '/' && req.headers.get('X-Role-Restriction') === null + req.url === '/' && req.headers.get('X-Role-Restriction') === null, ) .flush('hello', { status: 200, statusText: 'Success' }); @@ -54,7 +54,7 @@ describe('RestRoleInterceptor', () => { .expectOne( (req) => req.url === '/presence-control' && - req.headers.get('X-Role-Restriction') === 'LessonTeacherRole' + req.headers.get('X-Role-Restriction') === 'LessonTeacherRole', ) .flush('hello', { status: 200, statusText: 'Success' }); @@ -71,7 +71,7 @@ describe('RestRoleInterceptor', () => { .expectOne( (req) => req.url === '/my-absences' && - req.headers.get('X-Role-Restriction') === 'StudentRole' + req.headers.get('X-Role-Restriction') === 'StudentRole', ) .flush('hello', { status: 200, statusText: 'Success' }); @@ -89,7 +89,7 @@ describe('RestRoleInterceptor', () => { (req) => req.url === '/open-absences' && req.headers.get('X-Role-Restriction') === - 'LessonTeacherRole;ClassTeacherRole' + 'LessonTeacherRole;ClassTeacherRole', ) .flush('hello', { status: 200, statusText: 'Success' }); @@ -107,7 +107,7 @@ describe('RestRoleInterceptor', () => { (req) => req.url === '/edit-absences' && req.headers.get('X-Role-Restriction') === - 'LessonTeacherRole;ClassTeacherRole' + 'LessonTeacherRole;ClassTeacherRole', ) .flush('hello', { status: 200, statusText: 'Success' }); @@ -124,7 +124,7 @@ describe('RestRoleInterceptor', () => { .expectOne( (req) => req.url === '/evaluate-absences' && - req.headers.get('X-Role-Restriction') === null + req.headers.get('X-Role-Restriction') === null, ) .flush('hello', { status: 200, statusText: 'Success' }); @@ -141,7 +141,7 @@ describe('RestRoleInterceptor', () => { .expectOne( (req) => req.url === '/my-profile' && - req.headers.get('X-Role-Restriction') === null + req.headers.get('X-Role-Restriction') === null, ) .flush('hello', { status: 200, statusText: 'Success' }); diff --git a/src/app/shared/components/avatar/avatar.component.spec.ts b/src/app/shared/components/avatar/avatar.component.spec.ts index b6d5cbecb..4315002a1 100644 --- a/src/app/shared/components/avatar/avatar.component.spec.ts +++ b/src/app/shared/components/avatar/avatar.component.spec.ts @@ -20,7 +20,7 @@ describe('AvatarComponent', () => { }, }, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/shared/components/confirm-absences/confirm-absences.component.ts b/src/app/shared/components/confirm-absences/confirm-absences.component.ts index 7cd81867c..b7fef01de 100644 --- a/src/app/shared/components/confirm-absences/confirm-absences.component.ts +++ b/src/app/shared/components/confirm-absences/confirm-absences.component.ts @@ -52,7 +52,7 @@ import { ToastService } from '../../services/toast.service'; export class ConfirmAbsencesComponent implements OnInit, OnDestroy { formGroup$ = this.selectionService.selectedWithoutPresenceType$.pipe( map(this.createFormGroup.bind(this)), - shareReplay(1) + shareReplay(1), ); saving$ = new BehaviorSubject(false); @@ -62,7 +62,7 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { absenceTypeIdErrors$ = getValidationErrors( this.formGroup$, this.submitted$, - 'absenceTypeId' + 'absenceTypeId', ); private confirmationStates$ = this.dropDownItemsService @@ -71,11 +71,11 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { excusedState$ = findDropDownItem$( this.confirmationStates$, - this.settings.excusedAbsenceStateId + this.settings.excusedAbsenceStateId, ); unexcusedState$ = findDropDownItem$( this.confirmationStates$, - this.settings.unexcusedAbsenceStateId + this.settings.unexcusedAbsenceStateId, ); absenceTypes$ = this.presenceTypesService.confirmationTypes$; @@ -95,7 +95,7 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { @Inject(SETTINGS) private settings: Settings, @Optional() @Inject(CONFIRM_ABSENCES_SERVICE) - private openAbsencesEditService?: IConfirmAbsencesService + private openAbsencesEditService?: IConfirmAbsencesService, ) {} ngOnInit(): void { @@ -141,7 +141,7 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { ]) .pipe(takeUntil(this.destroy$)) .subscribe(([confirmationValueControl, excusedState]) => - confirmationValueControl.setValue(excusedState.Key) + confirmationValueControl.setValue(excusedState.Key), ); } @@ -165,12 +165,12 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { getSelectedCount(): Observable { return this.selectionService.selectedLessons$.pipe( - map((lessons) => lessons.length) + map((lessons) => lessons.length), ); } private createFormGroup( - selectedWithoutPresenceType: ReadonlyArray + selectedWithoutPresenceType: ReadonlyArray, ): UntypedFormGroup { return selectedWithoutPresenceType.length > 0 ? this.fb.group({ @@ -186,7 +186,7 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { combineLatest([ getControl(this.formGroup$, 'absenceTypeId').pipe( take(1), - filter(notNull) + filter(notNull), ), this.excusedState$.pipe(take(1), filter(notNull)), ]).subscribe(([absenceTypeIdControl, excusedState]) => { @@ -214,14 +214,14 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { presenceTypeId, confirmationValue, Number(unexcusedState.Key), - absenceTypeId + absenceTypeId, ), - confirmationValue - ) - ) - ) + confirmationValue, + ), + ), + ), ), - finalize(() => this.saving$.next(false)) + finalize(() => this.saving$.next(false)), ) .subscribe(this.onSaveSuccess.bind(this)); } @@ -230,7 +230,7 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { currentAbsenceTypeId: Option, confirmationValue: number, unexcusedState: number, - absenceTypeId: number + absenceTypeId: number, ): number { if (!currentAbsenceTypeId) { throw new Error('absence type id cannot be null'); @@ -250,7 +250,7 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { this.openAbsencesEditService.updateAfterConfirm(); } this.toastService.success( - this.translate.instant('open-absences.edit.save-success') + this.translate.instant('open-absences.edit.save-success'), ); this.navigateBack(); } @@ -261,7 +261,7 @@ export class ConfirmAbsencesComponent implements OnInit, OnDestroy { { relativeTo: this.activatedRoute, queryParams: this.openAbsencesEditService?.confirmBackLinkParams, - } + }, ); } } diff --git a/src/app/shared/components/date-select/date-select.component.spec.ts b/src/app/shared/components/date-select/date-select.component.spec.ts index da3058355..13600952c 100644 --- a/src/app/shared/components/date-select/date-select.component.spec.ts +++ b/src/app/shared/components/date-select/date-select.component.spec.ts @@ -9,7 +9,7 @@ describe('DateSelectComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({}) + buildTestModuleMetadata({}), ).compileComponents(); })); diff --git a/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.spec.ts b/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.spec.ts index bf4e4c045..bac4a6fe6 100644 --- a/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.spec.ts @@ -21,7 +21,7 @@ describe('DossierAbsencesComponent', () => { StudentDossierAbsencesComponent, ], providers: [DossierStateService, ConfirmAbsencesSelectionService], - }) + }), ) .overrideComponent(DossierAbsencesComponent, { set: { diff --git a/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.ts b/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.ts index c8915eb4b..94c592d56 100644 --- a/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.ts +++ b/src/app/shared/components/student-dossier/dossier-absences/dossier-absences.component.ts @@ -26,7 +26,7 @@ export class DossierAbsencesComponent implements OnInit, OnDestroy { private state: DossierStateService, private presenceTypesService: PresenceTypesService, public absencesService: StudentProfileAbsencesService, - public absencesSelectionService: ConfirmAbsencesSelectionService + public absencesSelectionService: ConfirmAbsencesSelectionService, ) { this.state.currentDossier$.next('absences'); } diff --git a/src/app/shared/components/student-dossier/dossier-addresses/dossier-addresses.component.spec.ts b/src/app/shared/components/student-dossier/dossier-addresses/dossier-addresses.component.spec.ts index e700b41c0..96969d300 100644 --- a/src/app/shared/components/student-dossier/dossier-addresses/dossier-addresses.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-addresses/dossier-addresses.component.spec.ts @@ -42,7 +42,7 @@ describe('DossierAddressesComponent', () => { providers: [ { provide: DossierStateService, useValue: stateServiceMock }, ], - }) + }), ).compileComponents(); }); diff --git a/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts b/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts index c9af9b667..75b4cd841 100644 --- a/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts @@ -16,7 +16,7 @@ describe('DossierGradesCourseHeaderComponent', () => { await TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [DossierGradesCourseHeaderComponent], - }) + }), ).compileComponents(); }); diff --git a/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.spec.ts b/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.spec.ts index 0766c8a1f..edc263aa3 100644 --- a/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.spec.ts @@ -14,7 +14,7 @@ describe('DossierGradesEditComponent', () => { buildTestModuleMetadata({ declarations: [DossierGradesEditComponent], providers: [NgbActiveModal], - }) + }), ).compileComponents(); }); diff --git a/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.ts b/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.ts index 4d4b03d12..b3e7182fd 100644 --- a/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.ts +++ b/src/app/shared/components/student-dossier/dossier-grades-edit/dossier-grades-edit.component.ts @@ -52,19 +52,19 @@ export class DossierGradesEditComponent implements OnInit { gradingScaleDisabled$: BehaviorSubject = new BehaviorSubject(true); grade$: Observable = this.gradeSubject$.pipe( - debounceTime(DEBOUNCE_TIME) + debounceTime(DEBOUNCE_TIME), ); points$: Observable = this.pointsSubject$.pipe( debounceTime(DEBOUNCE_TIME), filter(this.isValid.bind(this)), - map(Number) + map(Number), ); destroy$ = new Subject(); constructor( public activeModal: NgbActiveModal, - private courseService: CoursesRestService + private courseService: CoursesRestService, ) {} ngOnInit(): void { @@ -75,23 +75,23 @@ export class DossierGradesEditComponent implements OnInit { Validators.min(0), Validators.pattern('[0-9]+([\\.][0-9]+)?'), this.maxPointValidator(), - ] + ], ); this.gradingScaleDisabled$.next( - this.test.IsPointGrading && this.points > 0 + this.test.IsPointGrading && this.points > 0, ); this.grade$ .pipe( takeUntil(this.destroy$), - map(this.buildRuequestBodyForGradeChange.bind(this)) + map(this.buildRuequestBodyForGradeChange.bind(this)), ) .subscribe((body) => this.updateTestResult(body)); this.points$ .pipe( takeUntil(this.destroy$), - map(this.buildRequestBodyPointsChange.bind(this)) + map(this.buildRequestBodyPointsChange.bind(this)), ) .subscribe((body) => this.updateTestResult(body)); } diff --git a/src/app/shared/components/student-dossier/dossier-grades-final-grade/dossier-grades-final-grade.component.spec.ts b/src/app/shared/components/student-dossier/dossier-grades-final-grade/dossier-grades-final-grade.component.spec.ts index 74b4c9859..afd9f1340 100644 --- a/src/app/shared/components/student-dossier/dossier-grades-final-grade/dossier-grades-final-grade.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-grades-final-grade/dossier-grades-final-grade.component.spec.ts @@ -17,7 +17,7 @@ describe('DossierGradesFinalGradeComponent', () => { await TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [DossierGradesFinalGradeComponent], - }) + }), ).compileComponents(); }); diff --git a/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.spec.ts b/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.spec.ts index b05b0086e..b46725625 100644 --- a/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.spec.ts @@ -28,7 +28,7 @@ describe('DossierGradesViewComponent', () => { }, }, ], - }) + }), ).compileComponents(); }); diff --git a/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.ts b/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.ts index 5082b4d4a..2be93b4d7 100644 --- a/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.ts +++ b/src/app/shared/components/student-dossier/dossier-grades-view/dossier-grades-view.component.ts @@ -46,12 +46,12 @@ export class DossierGradesViewComponent implements OnChanges { return this.courses?.map((course) => { const finalGrade = this.dossierGradeService.getFinalGradeForStudent( course, - this.studentId + this.studentId, ); const grades = this.dossierGradeService.getGradesForStudent( course, this.studentId, - this.gradingScales + this.gradingScales, ); return { @@ -59,11 +59,11 @@ export class DossierGradesViewComponent implements OnChanges { finalGrade, grading: this.dossierGradeService.getGradingForStudent( course, - this.studentId + this.studentId, ), gradingScale: this.dossierGradeService.getGradingScaleOfCourse( course, - this.gradingScales + this.gradingScales, ), average: finalGrade?.AverageTestResult || weightedAverage(grades), }; diff --git a/src/app/shared/components/student-dossier/dossier-grades/dossier-grades.component.ts b/src/app/shared/components/student-dossier/dossier-grades/dossier-grades.component.ts index 68fb29049..ecfa1abf8 100644 --- a/src/app/shared/components/student-dossier/dossier-grades/dossier-grades.component.ts +++ b/src/app/shared/components/student-dossier/dossier-grades/dossier-grades.component.ts @@ -11,7 +11,7 @@ import { DossierStateService } from 'src/app/shared/services/dossier-state.servi export class DossierGradesComponent implements OnInit, OnDestroy { constructor( public state: DossierStateService, - public dossierGradesService: DossierGradesService + public dossierGradesService: DossierGradesService, ) {} private destroy$ = new Subject(); diff --git a/src/app/shared/components/student-dossier/dossier-single-test/dossier-single-test.component.spec.ts b/src/app/shared/components/student-dossier/dossier-single-test/dossier-single-test.component.spec.ts index d1629d158..84a2d14ee 100644 --- a/src/app/shared/components/student-dossier/dossier-single-test/dossier-single-test.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-single-test/dossier-single-test.component.spec.ts @@ -35,7 +35,7 @@ describe('DossierSingleTestComponent', () => { useValue: jasmine.createSpyObj('StorageService', ['getPayload']), }, ], - }) + }), ).compileComponents(); }); @@ -60,7 +60,7 @@ describe('DossierSingleTestComponent', () => { expectText( debugElement, 'test-designation', - 'Test Designation for test with id 123' + 'Test Designation for test with id 123', ); }); diff --git a/src/app/shared/components/student-dossier/student-backlink/student-backlink.component.spec.ts b/src/app/shared/components/student-dossier/student-backlink/student-backlink.component.spec.ts index 53b912830..4caceb1fd 100644 --- a/src/app/shared/components/student-dossier/student-backlink/student-backlink.component.spec.ts +++ b/src/app/shared/components/student-dossier/student-backlink/student-backlink.component.spec.ts @@ -11,7 +11,7 @@ describe('StudentBacklinkComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [StudentBacklinkComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/shared/components/student-dossier/student-dossier-absences/student-dossier-absences.component.spec.ts b/src/app/shared/components/student-dossier/student-dossier-absences/student-dossier-absences.component.spec.ts index 0aa22954b..36050d190 100644 --- a/src/app/shared/components/student-dossier/student-dossier-absences/student-dossier-absences.component.spec.ts +++ b/src/app/shared/components/student-dossier/student-dossier-absences/student-dossier-absences.component.spec.ts @@ -11,7 +11,7 @@ describe('StudentDossierAbsencesComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [StudentDossierAbsencesComponent], - }) + }), ).compileComponents(); })); diff --git a/src/app/shared/components/student-dossier/student-dossier-address/student-dossier-address.component.spec.ts b/src/app/shared/components/student-dossier/student-dossier-address/student-dossier-address.component.spec.ts index 441cc2162..0e8dc553f 100644 --- a/src/app/shared/components/student-dossier/student-dossier-address/student-dossier-address.component.spec.ts +++ b/src/app/shared/components/student-dossier/student-dossier-address/student-dossier-address.component.spec.ts @@ -34,7 +34,7 @@ describe('StudentDossierAddressComponent', () => { fixture.detectChanges(); expectText( - 'Spitalgasse 1 Postfach 3000 Bern +41 31 123 45 67 +41 79 123 45 67 fritz@example.com' + 'Spitalgasse 1 Postfach 3000 Bern +41 31 123 45 67 +41 79 123 45 67 fritz@example.com', ); }); @@ -60,7 +60,7 @@ describe('StudentDossierAddressComponent', () => { fixture.detectChanges(); expectText( - 'Spitalgasse 1 Postfach 3000 Bern +41 31 123 45 67 +41 79 123 45 67 fritz@example.com' + 'Spitalgasse 1 Postfach 3000 Bern +41 31 123 45 67 +41 79 123 45 67 fritz@example.com', ); }); @@ -76,7 +76,7 @@ describe('StudentDossierAddressComponent', () => { fixture.detectChanges(); expectText( - 'Spitalgasse 1 3000 Bern +41 79 123 45 67 alternative@example.com' + 'Spitalgasse 1 3000 Bern +41 79 123 45 67 alternative@example.com', ); }); }); diff --git a/src/app/shared/components/student-dossier/student-dossier-apprenticeship-company/student-dossier-apprenticeship-company.component.spec.ts b/src/app/shared/components/student-dossier/student-dossier-apprenticeship-company/student-dossier-apprenticeship-company.component.spec.ts index f688b140b..202614b08 100644 --- a/src/app/shared/components/student-dossier/student-dossier-apprenticeship-company/student-dossier-apprenticeship-company.component.spec.ts +++ b/src/app/shared/components/student-dossier/student-dossier-apprenticeship-company/student-dossier-apprenticeship-company.component.spec.ts @@ -16,13 +16,13 @@ describe('StudentDossierApprenticeshipCompanyComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [StudentDossierApprenticeshipCompanyComponent], - }) + }), ).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent( - StudentDossierApprenticeshipCompanyComponent + StudentDossierApprenticeshipCompanyComponent, ); component = fixture.componentInstance; component.company = { diff --git a/src/app/shared/components/student-dossier/student-dossier-legal-representative/student-dossier-legal-representative.component.spec.ts b/src/app/shared/components/student-dossier/student-dossier-legal-representative/student-dossier-legal-representative.component.spec.ts index ee9007ec5..cbecb5576 100644 --- a/src/app/shared/components/student-dossier/student-dossier-legal-representative/student-dossier-legal-representative.component.spec.ts +++ b/src/app/shared/components/student-dossier/student-dossier-legal-representative/student-dossier-legal-representative.component.spec.ts @@ -12,13 +12,13 @@ describe('StudentDossierLegalRepresentativeComponent', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ declarations: [StudentDossierLegalRepresentativeComponent], - }) + }), ).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent( - StudentDossierLegalRepresentativeComponent + StudentDossierLegalRepresentativeComponent, ); component = fixture.componentInstance; component.person = buildPerson(123); diff --git a/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.spec.ts b/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.spec.ts index 57b1960c7..0e9bccc6c 100644 --- a/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.spec.ts +++ b/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.spec.ts @@ -24,7 +24,7 @@ describe('StudentDossierComponent', () => { useValue: jasmine.createSpyObj('StorageService', ['getPayload']), }, ], - }) + }), ).compileComponents(); })); diff --git a/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.ts b/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.ts index 7336d04d1..cdbd41970 100644 --- a/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.ts +++ b/src/app/shared/components/student-dossier/student-dossier/student-dossier.component.ts @@ -12,7 +12,7 @@ import { DossierStateService } from '../../../services/dossier-state.service'; export class StudentDossierComponent { constructor( public state: DossierStateService, - public dossierGradesService: DossierGradesService + public dossierGradesService: DossierGradesService, ) { this.state.currentDossier$.next('addresses'); } diff --git a/src/app/shared/components/typeahead/typeahead.component.spec.ts b/src/app/shared/components/typeahead/typeahead.component.spec.ts index ee5f8d156..4a34f6b83 100644 --- a/src/app/shared/components/typeahead/typeahead.component.spec.ts +++ b/src/app/shared/components/typeahead/typeahead.component.spec.ts @@ -9,7 +9,7 @@ describe('TypeaheadComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({}) + buildTestModuleMetadata({}), ).compileComponents(); })); diff --git a/src/app/shared/components/typeahead/typeahead.component.ts b/src/app/shared/components/typeahead/typeahead.component.ts index 1bb68ad8f..4265e8328 100644 --- a/src/app/shared/components/typeahead/typeahead.component.ts +++ b/src/app/shared/components/typeahead/typeahead.component.ts @@ -44,7 +44,7 @@ export class TypeaheadComponent implements OnChanges { @Output() valueChange = this.selectedItem$.pipe( map((item) => (item ? item.Key : null)), - distinctUntilChanged() + distinctUntilChanged(), ); componentId = uniqueId('erz-typeahead-'); @@ -67,7 +67,7 @@ export class TypeaheadComponent implements OnChanges { search = (term$: Observable) => { return term$.pipe( processTerm(MINIMAL_TERM_LENGTH, FETCH_DEBOUNCE_TIME), - switchMap(this.fetchItems.bind(this)) + switchMap(this.fetchItems.bind(this)), ); }; @@ -77,7 +77,7 @@ export class TypeaheadComponent implements OnChanges { modelChange(value: unknown): void { this.selectedItem$.next( - value instanceof Object ? (value as DropDownItem) : null + value instanceof Object ? (value as DropDownItem) : null, ); } @@ -102,14 +102,14 @@ export class TypeaheadComponent implements OnChanges { function processTerm( minimalTermLength: number, - fetchDebounceTime: number + fetchDebounceTime: number, ): (source$: Observable) => Observable { return (source$) => source$.pipe( debounceTime(fetchDebounceTime), map(normalizeTerm), distinctUntilChanged(), - filter(longerOrEqual(minimalTermLength)) + filter(longerOrEqual(minimalTermLength)), ); } diff --git a/src/app/shared/models/common-types.spec.ts b/src/app/shared/models/common-types.spec.ts index 73e510aef..ee6531f08 100644 --- a/src/app/shared/models/common-types.spec.ts +++ b/src/app/shared/models/common-types.spec.ts @@ -16,7 +16,7 @@ describe('common types', () => { fold(left, right)(LocalDateTimeFromString.decode('2019-08-07T11:00:00')); expect(left).not.toHaveBeenCalled(); expect(right).toHaveBeenCalledWith( - parseISOLocalDateTime('2019-08-07T11:00:00') + parseISOLocalDateTime('2019-08-07T11:00:00'), ); }); @@ -28,7 +28,7 @@ describe('common types', () => { it('formats given date to date time string', () => { expect( - LocalDateTimeFromString.encode(new Date('2019-08-07T11:00:00')) + LocalDateTimeFromString.encode(new Date('2019-08-07T11:00:00')), ).toEqual('2019-08-07T11:00:00'); }); }); @@ -56,7 +56,7 @@ describe('common types', () => { it('formats given date to date string', () => { expect( - LocalDateFromString.encode(new Date('2019-08-07T11:00:00')) + LocalDateFromString.encode(new Date('2019-08-07T11:00:00')), ).toEqual('2019-08-07'); }); }); diff --git a/src/app/shared/models/common-types.ts b/src/app/shared/models/common-types.ts index da7568f97..1865678b3 100644 --- a/src/app/shared/models/common-types.ts +++ b/src/app/shared/models/common-types.ts @@ -10,13 +10,13 @@ import { } from '../utils/date'; export function Option( - optionalType: T + optionalType: T, ): t.UnionC<[t.NullC, T]> { return t.union([t.null, optionalType]); } export function Maybe( - maybeType: T + maybeType: T, ): t.UnionC<[t.NullC, t.UndefinedC, T]> { return t.union([t.null, t.undefined, maybeType]); } @@ -43,9 +43,9 @@ export const LocalDateTimeFromString = new t.Type( chain((s) => { const d = parseISOLocalDateTime(s); return isNaN(d.getTime()) ? t.failure(u, c) : t.success(d); - }) + }), ), - (a) => formatISOLocalDateTime(a) + (a) => formatISOLocalDateTime(a), ); export const LocalDateFromString = new t.Type( @@ -57,7 +57,7 @@ export const LocalDateFromString = new t.Type( chain((s) => { const d = parseISOLocalDate(s); return isNaN(d.getTime()) ? t.failure(u, c) : t.success(d); - }) + }), ), - (a) => formatISOLocalDate(a) + (a) => formatISOLocalDate(a), ); diff --git a/src/app/shared/models/user-setting.model.spec.ts b/src/app/shared/models/user-setting.model.spec.ts index 8494e6de2..06426cc71 100644 --- a/src/app/shared/models/user-setting.model.spec.ts +++ b/src/app/shared/models/user-setting.model.spec.ts @@ -28,11 +28,11 @@ describe('user settings types', () => { it('converts JSON string with truthy values to object', () => { fold( left, - right + right, )( NotificationChannels.decode( - '{"mail":true,"gui":true,"phoneMobile":true}' - ) + '{"mail":true,"gui":true,"phoneMobile":true}', + ), ); expect(left).not.toHaveBeenCalled(); expect(right).toHaveBeenCalledWith({ @@ -45,11 +45,11 @@ describe('user settings types', () => { it('converts JSON string with falsy values to object', () => { fold( left, - right + right, )( NotificationChannels.decode( - '{"mail":false,"gui":false,"phoneMobile":false}' - ) + '{"mail":false,"gui":false,"phoneMobile":false}', + ), ); expect(left).not.toHaveBeenCalled(); expect(right).toHaveBeenCalledWith({ @@ -62,11 +62,11 @@ describe('user settings types', () => { it('falls back to default values for JSON string with invalid properties', () => { fold( left, - right + right, )( NotificationChannels.decode( - '{"mail":123,"gui":"foo","phoneMobile":{}}' - ) + '{"mail":123,"gui":"foo","phoneMobile":{}}', + ), ); expect(left).not.toHaveBeenCalled(); expect(right).toHaveBeenCalledWith({ @@ -96,7 +96,7 @@ describe('user settings types', () => { mail: true, gui: false, phoneMobile: true, - }) + }), ).toEqual('{"mail":true,"gui":false,"phoneMobile":true}'); }); }); @@ -115,11 +115,11 @@ describe('user settings types', () => { it('converts semicolon-separated string to array', () => { fold( left, - right + right, )( NotificationTypesInactive.decode( - 'BM2Teacher;absenceMessage;teacherSubstitutions' - ) + 'BM2Teacher;absenceMessage;teacherSubstitutions', + ), ); expect(left).not.toHaveBeenCalled(); expect(right).toHaveBeenCalledWith([ @@ -150,13 +150,13 @@ describe('user settings types', () => { it('fails for array with invalid value', () => { fold( left, - right + right, )( NotificationTypesInactive.decode([ 'BM2Teacher', 123, 'absenceMessage', - ]) + ]), ); expect(left).toHaveBeenCalled(); expect(right).not.toHaveBeenCalled(); @@ -170,13 +170,13 @@ describe('user settings types', () => { 'BM2Teacher', 'absenceMessage', 'teacherSubstitutions', - ]) + ]), ).toEqual('BM2Teacher;absenceMessage;teacherSubstitutions'); }); it('converts single-value array to string', () => { expect(NotificationTypesInactive.encode(['BM2Teacher'])).toEqual( - 'BM2Teacher' + 'BM2Teacher', ); }); }); diff --git a/src/app/shared/pipes/days-difference.pipe.spec.ts b/src/app/shared/pipes/days-difference.pipe.spec.ts index 6831481ca..be8713132 100644 --- a/src/app/shared/pipes/days-difference.pipe.spec.ts +++ b/src/app/shared/pipes/days-difference.pipe.spec.ts @@ -9,7 +9,7 @@ describe('DaysDifferencePipe', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({}) + buildTestModuleMetadata({}), ).compileComponents(); pipe = new DaysDifferencePipe(TestBed.inject(TranslateService)); })); diff --git a/src/app/shared/pipes/days-difference.pipe.ts b/src/app/shared/pipes/days-difference.pipe.ts index 644a9b019..34cbf05fc 100644 --- a/src/app/shared/pipes/days-difference.pipe.ts +++ b/src/app/shared/pipes/days-difference.pipe.ts @@ -17,7 +17,7 @@ export class DaysDifferencePipe implements PipeTransform { `shared.daysDifference.${this.getKey(difference)}`, { count: Math.abs(difference), - } + }, ); } diff --git a/src/app/shared/pipes/person-email.pipe.spec.ts b/src/app/shared/pipes/person-email.pipe.spec.ts index 049981377..7d86ae7b7 100644 --- a/src/app/shared/pipes/person-email.pipe.spec.ts +++ b/src/app/shared/pipes/person-email.pipe.spec.ts @@ -19,9 +19,9 @@ describe('PersonEmailPipe', () => { 12345, 'first@email.ch', 'second@email.ch', - 'third@email.ch' - ) - ) + 'third@email.ch', + ), + ), ).toBe('first@email.ch'); }); @@ -32,25 +32,25 @@ describe('PersonEmailPipe', () => { 12345, undefined, 'second@email.ch', - 'third@email.ch' - ) - ) + 'third@email.ch', + ), + ), ).toBe('second@email.ch'); }); it('should return the email address with a value - email', () => { expect( personEmailPipe.transform( - buildPersonWithEmails(12345, undefined, 'second@email.ch', undefined) - ) + buildPersonWithEmails(12345, undefined, 'second@email.ch', undefined), + ), ).toBe('second@email.ch'); }); it('should return the first email address with a value - email2', () => { expect( personEmailPipe.transform( - buildPersonWithEmails(12345, undefined, undefined, 'third@email.ch') - ) + buildPersonWithEmails(12345, undefined, undefined, 'third@email.ch'), + ), ).toBe('third@email.ch'); }); }); diff --git a/src/app/shared/pipes/test-points.pipe.spec.ts b/src/app/shared/pipes/test-points.pipe.spec.ts index 2b9f415f8..ba46c2c39 100644 --- a/src/app/shared/pipes/test-points.pipe.spec.ts +++ b/src/app/shared/pipes/test-points.pipe.spec.ts @@ -13,7 +13,7 @@ describe('TestsPointsPipe', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({}) + buildTestModuleMetadata({}), ).compileComponents(); pipe = new TestPointsPipe(TestBed.inject(TranslateService)); })); diff --git a/src/app/shared/pipes/test-weight.pipe.spec.ts b/src/app/shared/pipes/test-weight.pipe.spec.ts index 24f08b820..237195bf8 100644 --- a/src/app/shared/pipes/test-weight.pipe.spec.ts +++ b/src/app/shared/pipes/test-weight.pipe.spec.ts @@ -11,7 +11,7 @@ describe('TestsWeightPipe', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({}) + buildTestModuleMetadata({}), ).compileComponents(); pipe = new TestsWeightPipe(TestBed.inject(TranslateService)); })); diff --git a/src/app/shared/services/apprenticeship-managers-rest.service.spec.ts b/src/app/shared/services/apprenticeship-managers-rest.service.spec.ts index 7a0c043a0..62f2241e5 100644 --- a/src/app/shared/services/apprenticeship-managers-rest.service.spec.ts +++ b/src/app/shared/services/apprenticeship-managers-rest.service.spec.ts @@ -8,7 +8,7 @@ describe('ApprenticeshipManagerRestService', () => { it('should be created', () => { const service: ApprenticeshipManagersRestService = TestBed.inject( - ApprenticeshipManagersRestService + ApprenticeshipManagersRestService, ); expect(service).toBeTruthy(); }); diff --git a/src/app/shared/services/confirm-absences-selection.service.ts b/src/app/shared/services/confirm-absences-selection.service.ts index eee048ec6..28dd61814 100644 --- a/src/app/shared/services/confirm-absences-selection.service.ts +++ b/src/app/shared/services/confirm-absences-selection.service.ts @@ -20,9 +20,9 @@ export class ConfirmAbsencesSelectionService extends SelectionService< getIdsGroupedByPersonAndPresenceType([ ...flattenOpenAbsencesEntries(openAbsencesEntries), ...lessonPresences, - ]) + ]), ), - shareReplay(1) + shareReplay(1), ); selectedLessons$ = this.selection$.pipe( @@ -31,7 +31,7 @@ export class ConfirmAbsencesSelectionService extends SelectionService< ...flattenOpenAbsencesEntries(openAbsencesEntries), ...lessonPresences, ]), - shareReplay(1) + shareReplay(1), ); /** @@ -44,8 +44,8 @@ export class ConfirmAbsencesSelectionService extends SelectionService< [ ...flattenOpenAbsencesEntries(openAbsencesEntries), ...lessonPresences, - ].filter((p) => p.TypeRef.Id === this.settings.absencePresenceTypeId) - ) + ].filter((p) => p.TypeRef.Id === this.settings.absencePresenceTypeId), + ), ); constructor(@Inject(SETTINGS) private settings: Settings) { @@ -66,7 +66,7 @@ export class ConfirmAbsencesSelectionService extends SelectionService< } function getEntriesByType( - entries: ReadonlyArray + entries: ReadonlyArray, ): { openAbsencesEntries: ReadonlyArray; lessonPresences: ReadonlyArray; @@ -74,7 +74,7 @@ function getEntriesByType( return { openAbsencesEntries: entries.filter(isInstanceOf(OpenAbsencesEntry)), lessonPresences: entries.filter( - not(isInstanceOf(OpenAbsencesEntry)) + not(isInstanceOf(OpenAbsencesEntry)), ) as ReadonlyArray, }; } diff --git a/src/app/shared/services/courses-rest.service.ts b/src/app/shared/services/courses-rest.service.ts index 86859e723..fd175a529 100644 --- a/src/app/shared/services/courses-rest.service.ts +++ b/src/app/shared/services/courses-rest.service.ts @@ -26,7 +26,7 @@ export class CoursesRestService extends RestService { return this.http .get( `${this.baseUrl}/?expand=EvaluationStatusRef,AttendanceRef,Classes,FinalGrades&filter.StatusId=;${this.settings.eventlist.statusfilter}`, - { headers: { 'X-Role-Restriction': 'TeacherRole' } } + { headers: { 'X-Role-Restriction': 'TeacherRole' } }, ) .pipe(switchMap(decodeArray(Course))); } @@ -37,7 +37,7 @@ export class CoursesRestService extends RestService { getExpandedCourse(courseId: number): Observable { return this.http .get( - `${this.baseUrl}/${courseId}?expand=ParticipatingStudents,EvaluationStatusRef,Tests,Gradings,FinalGrades,Classes` + `${this.baseUrl}/${courseId}?expand=ParticipatingStudents,EvaluationStatusRef,Tests,Gradings,FinalGrades,Classes`, ) .pipe(switchMap(decode(Course))); } @@ -45,7 +45,7 @@ export class CoursesRestService extends RestService { getExpandedCoursesForDossier(): Observable> { return this.http .get( - `${this.baseUrl}/?expand=Tests,Gradings,FinalGrades,EvaluationStatusRef,ParticipatingStudents,Classes&filter.StatusId=;${this.settings.eventlist.statusfilter}` + `${this.baseUrl}/?expand=Tests,Gradings,FinalGrades,EvaluationStatusRef,ParticipatingStudents,Classes&filter.StatusId=;${this.settings.eventlist.statusfilter}`, ) .pipe(switchMap(decodeArray(Course))); } @@ -56,7 +56,7 @@ export class CoursesRestService extends RestService { `${this.baseUrl}/?expand=Tests,Gradings,FinalGrades&filter.StatusId=;${this.settings.eventlist.statusfilter}`, { headers: { 'X-Role-Restriction': 'StudentRole' }, - } + }, ) .pipe(switchMap(decodeArray(Course))); } @@ -68,7 +68,7 @@ export class CoursesRestService extends RestService { weight: number, isPointGrading: boolean, maxPoints: Maybe, - maxPointsAdjusted: Maybe + maxPointsAdjusted: Maybe, ): Observable { const body = { Tests: [ @@ -95,7 +95,7 @@ export class CoursesRestService extends RestService { weight: number, isPointGrading: boolean, maxPoints: Maybe, - maxPointsAdjusted: Maybe + maxPointsAdjusted: Maybe, ): Observable { const body = { Tests: [ @@ -126,13 +126,13 @@ export class CoursesRestService extends RestService { updateTestResult( courseId: number, - body: TestPointsResult | TestGradesResult + body: TestPointsResult | TestGradesResult, ): Observable<{ courseId: number; body: UpdatedTestResultResponse }> { return this.http .put(`${this.baseUrl}/${courseId}/SetTestResult`, body) .pipe( switchMap(decode(UpdatedTestResultResponse)), - switchMap((value) => of({ courseId, body: value })) + switchMap((value) => of({ courseId, body: value })), ); } diff --git a/src/app/shared/services/dossier-state.service.spec.ts b/src/app/shared/services/dossier-state.service.spec.ts index cd749d98d..ff58ebabb 100644 --- a/src/app/shared/services/dossier-state.service.spec.ts +++ b/src/app/shared/services/dossier-state.service.spec.ts @@ -8,7 +8,7 @@ describe('DossierStateService', () => { beforeEach(() => { TestBed.configureTestingModule( - buildTestModuleMetadata({ providers: [DossierStateService] }) + buildTestModuleMetadata({ providers: [DossierStateService] }), ); service = TestBed.inject(DossierStateService); }); diff --git a/src/app/shared/services/dossier-state.service.ts b/src/app/shared/services/dossier-state.service.ts index 53dc6f0ec..a9bf54a7d 100644 --- a/src/app/shared/services/dossier-state.service.ts +++ b/src/app/shared/services/dossier-state.service.ts @@ -10,16 +10,16 @@ export class DossierStateService { currentDossier$ = new BehaviorSubject('addresses'); studentId$ = this.route.paramMap.pipe( - map((params) => Number(params.get('id'))) + map((params) => Number(params.get('id'))), ); profile$ = this.studentId$.pipe( switchMap((id) => this.profileService.getProfile(id)), - shareReplay(1) + shareReplay(1), ); returnParams$ = this.route.queryParams.pipe( - map(({ returnparams }) => returnparams) + map(({ returnparams }) => returnparams), ); backlinkQueryParams$ = this.returnParams$.pipe(map(parseQueryString)); @@ -27,6 +27,6 @@ export class DossierStateService { constructor( public profileService: StudentProfileService, - private route: ActivatedRoute + private route: ActivatedRoute, ) {} } diff --git a/src/app/shared/services/drop-down-items-rest.service.spec.ts b/src/app/shared/services/drop-down-items-rest.service.spec.ts index 5fb9648eb..c6c68c54a 100644 --- a/src/app/shared/services/drop-down-items-rest.service.spec.ts +++ b/src/app/shared/services/drop-down-items-rest.service.spec.ts @@ -8,7 +8,7 @@ describe('DropdownItemsRestService', () => { it('should be created', () => { const service: DropDownItemsRestService = TestBed.inject( - DropDownItemsRestService + DropDownItemsRestService, ); expect(service).toBeTruthy(); }); diff --git a/src/app/shared/services/drop-down-items-rest.service.ts b/src/app/shared/services/drop-down-items-rest.service.ts index 4443c5714..1c1d079a8 100644 --- a/src/app/shared/services/drop-down-items-rest.service.ts +++ b/src/app/shared/services/drop-down-items-rest.service.ts @@ -13,7 +13,7 @@ import { Observable } from 'rxjs'; export class DropDownItemsRestService { constructor( private http: HttpClient, - @Inject(SETTINGS) private settings: Settings + @Inject(SETTINGS) private settings: Settings, ) {} getAbsenceConfirmationStates(): Observable> { diff --git a/src/app/shared/services/educational-events-rest.service.ts b/src/app/shared/services/educational-events-rest.service.ts index f1374f7db..405c98ac0 100644 --- a/src/app/shared/services/educational-events-rest.service.ts +++ b/src/app/shared/services/educational-events-rest.service.ts @@ -22,14 +22,14 @@ export class EducationalEventsRestService implements TypeaheadService { protected typeaheadCodec = t.type( - pick(this.codec.props, ['Id', 'Designation', 'Number']) + pick(this.codec.props, ['Id', 'Designation', 'Number']), ); constructor( http: HttpClient, @Inject(SETTINGS) settings: Settings, private translate: TranslateService, - private toastService: ToastService + private toastService: ToastService, ) { super(http, settings, EducationalEvent, 'EducationalEvents'); } @@ -48,8 +48,8 @@ export class EducationalEventsRestService items.map((i) => ({ Key: i.Id, Value: `${i.Designation} (${i.Number})`, - })) - ) + })), + ), ); } @@ -67,7 +67,7 @@ export class EducationalEventsRestService if (items.length === 0) { this.toastService.error( this.translate.instant(`global.rest-errors.notfound-message`), - this.translate.instant(`global.rest-errors.notfound-title`) + this.translate.instant(`global.rest-errors.notfound-title`), ); return EMPTY as Observable; } @@ -75,7 +75,7 @@ export class EducationalEventsRestService Key: items[0].Id, Value: `${items[0].Designation} (${items[0].Number})`, }); - }) + }), ); } } diff --git a/src/app/shared/services/events-rest.service.ts b/src/app/shared/services/events-rest.service.ts index ffa2b94f7..89537971d 100644 --- a/src/app/shared/services/events-rest.service.ts +++ b/src/app/shared/services/events-rest.service.ts @@ -17,7 +17,7 @@ export class EventsRestService extends RestService { } getSubscriptionDetailsDefinitions( - eventId: number + eventId: number, ): Observable> { return this.http .get(`${this.baseUrl}/${eventId}/SubscriptionDetails`) diff --git a/src/app/shared/services/grading-scales-rest.service.ts b/src/app/shared/services/grading-scales-rest.service.ts index f962aa6fd..277383469 100644 --- a/src/app/shared/services/grading-scales-rest.service.ts +++ b/src/app/shared/services/grading-scales-rest.service.ts @@ -22,13 +22,13 @@ export class GradingScalesRestService extends RestService { } loadGradingScales( - observable: Observable<(number | null)[]> + observable: Observable<(number | null)[]>, ): Observable> { return observable.pipe( switchMap((ids) => - forkJoin(ids.map((id: number | null) => this.getGradingScale(id))) + forkJoin(ids.map((id: number | null) => this.getGradingScale(id))), ), - shareReplay(1) + shareReplay(1), ); } } diff --git a/src/app/shared/services/grading-scales.service-rest.spec.ts b/src/app/shared/services/grading-scales.service-rest.spec.ts index cbfa9b8d4..48bd28b43 100644 --- a/src/app/shared/services/grading-scales.service-rest.spec.ts +++ b/src/app/shared/services/grading-scales.service-rest.spec.ts @@ -28,7 +28,7 @@ describe('GradingScalesRestService', () => { httpTestingController .expectOne( - ({ url }) => url === 'https://eventotest.api/GradingScales/1234' + ({ url }) => url === 'https://eventotest.api/GradingScales/1234', ) .flush(data); }); diff --git a/src/app/shared/services/gradings-rest.service.spec.ts b/src/app/shared/services/gradings-rest.service.spec.ts index b9bbb6ed4..be5955e87 100644 --- a/src/app/shared/services/gradings-rest.service.spec.ts +++ b/src/app/shared/services/gradings-rest.service.spec.ts @@ -35,7 +35,7 @@ describe('GradingsRestService', () => { ({ method, url, body }) => method === 'PUT' && url === `https://eventotest.api/Gradings/${gradeId}` && - isEqual(body, { GradeId: selectedGradeId }) + isEqual(body, { GradeId: selectedGradeId }), ) .flush(gradeId); }); diff --git a/src/app/shared/services/gradings-rest.service.ts b/src/app/shared/services/gradings-rest.service.ts index 025e5a15c..04e2388fd 100644 --- a/src/app/shared/services/gradings-rest.service.ts +++ b/src/app/shared/services/gradings-rest.service.ts @@ -15,7 +15,7 @@ export class GradingsRestService extends RestService { updateGrade( finaleGradeId: number, - selectedGradeId: number + selectedGradeId: number, ): Observable { return this.http .put(`${this.baseUrl}/${finaleGradeId}`, { GradeId: selectedGradeId }) diff --git a/src/app/shared/services/i18n.service.ts b/src/app/shared/services/i18n.service.ts index e92cb7db4..1b7cfa137 100644 --- a/src/app/shared/services/i18n.service.ts +++ b/src/app/shared/services/i18n.service.ts @@ -11,7 +11,7 @@ const FALLBACK_LANGUAGE = LANGUAGES[0]; export class I18nService { constructor( private translate: TranslateService, - private storage: StorageService + private storage: StorageService, ) {} private detectedLanguage: Option; @@ -42,7 +42,7 @@ export class I18nService { getLocalizedLanguage(language: Maybe): string { language = LANGUAGES.find( - (l) => l === `${(language || '').toLowerCase()}-CH` + (l) => l === `${(language || '').toLowerCase()}-CH`, ); return language ? language : FALLBACK_LANGUAGE; } diff --git a/src/app/shared/services/job-trainers-rest.service.spec.ts b/src/app/shared/services/job-trainers-rest.service.spec.ts index c5506117f..5b7e50eaf 100644 --- a/src/app/shared/services/job-trainers-rest.service.spec.ts +++ b/src/app/shared/services/job-trainers-rest.service.spec.ts @@ -10,7 +10,7 @@ describe('JobTrainersRestService', () => { it('should be created', () => { const service: JobTrainersRestService = TestBed.inject( - JobTrainersRestService + JobTrainersRestService, ); expect(service).toBeTruthy(); }); diff --git a/src/app/shared/services/lesson-presences-rest.service.ts b/src/app/shared/services/lesson-presences-rest.service.ts index 8c386b611..42f0cf305 100644 --- a/src/app/shared/services/lesson-presences-rest.service.ts +++ b/src/app/shared/services/lesson-presences-rest.service.ts @@ -39,13 +39,13 @@ export class LessonPresencesRestService extends RestService< 'EventRef', 'StudyClassRef', 'TypeRef', - ]) + ]), ); constructor( http: HttpClient, @Inject(SETTINGS) settings: Settings, - private storage: StorageService + private storage: StorageService, ) { super(http, settings, LessonPresence, 'LessonPresences'); } @@ -63,7 +63,7 @@ export class LessonPresencesRestService extends RestService< } getListByLessons( - lessons: ReadonlyArray + lessons: ReadonlyArray, ): Observable> { if (lessons.length === 0) { return of([]); @@ -85,7 +85,7 @@ export class LessonPresencesRestService extends RestService< getListByDateStudentClass( date: Date, studentId: number, - studyClassId?: number + studyClassId?: number, ): Observable> { const params: Record = { 'filter.LessonDateTimeFrom': `=${format(date, 'yyyy-MM-dd')}`, @@ -116,7 +116,7 @@ export class LessonPresencesRestService extends RestService< * or uses a single request for lesson teachers and absence administrators). */ getListOfUnconfirmed( - params?: Dict + params?: Dict, ): Observable> { if (hasRole(this.storage.getPayload()?.roles, 'ClassTeacherRole')) { return forkJoin([ @@ -136,7 +136,7 @@ export class LessonPresencesRestService extends RestService< getStatistics( absencesFilter: EvaluateAbsencesFilter, absencesSorting: Option>, - offset: number + offset: number, ): Observable>> { let params = filteredParams([ [absencesFilter.student, 'StudentRef'], @@ -156,7 +156,7 @@ export class LessonPresencesRestService extends RestService< } getLessonRefs( - absencesFilter: EvaluateAbsencesFilter + absencesFilter: EvaluateAbsencesFilter, ): Observable> { let params = filteredParams([ [absencesFilter.student, 'StudentRef'], @@ -174,7 +174,7 @@ export class LessonPresencesRestService extends RestService< 'EventRef', 'StudyClassRef', 'TypeRef', - ].join(',') + ].join(','), ); return this.http @@ -183,7 +183,7 @@ export class LessonPresencesRestService extends RestService< } getRegistrationRefsByEventIds( - eventIds: ReadonlyArray + eventIds: ReadonlyArray, ): Observable> { let params = new HttpParams(); params.set('filter.EventRef', `;${eventIds.join(';')}`); @@ -196,7 +196,7 @@ export class LessonPresencesRestService extends RestService< 'EventRef', 'StudyClassRef', 'TypeRef', - ].join(',') + ].join(','), ); return this.http @@ -207,7 +207,7 @@ export class LessonPresencesRestService extends RestService< getFilteredList( absencesFilter: EditAbsencesFilter, offset: number, - additionalParams?: Dict + additionalParams?: Dict, ): Observable>> { let params = filteredParams( [ @@ -215,13 +215,13 @@ export class LessonPresencesRestService extends RestService< [absencesFilter.educationalEvent, 'EventRef'], [absencesFilter.studyClass, 'StudyClassRef'], ], - new HttpParams({ fromObject: additionalParams }) + new HttpParams({ fromObject: additionalParams }), ); if (absencesFilter.teacher) { params = params.set( 'filter.TeacherInformation', - `~*${absencesFilter.teacher}*` + `~*${absencesFilter.teacher}*`, ); } @@ -232,19 +232,19 @@ export class LessonPresencesRestService extends RestService< ) { params = params.set( 'filter.LessonDateTimeFrom', - `=${format(absencesFilter.dateFrom, 'yyyy-MM-dd')}` + `=${format(absencesFilter.dateFrom, 'yyyy-MM-dd')}`, ); } else { if (absencesFilter.dateFrom) { params = params.set( 'filter.LessonDateTimeFrom', - `>${format(subDays(absencesFilter.dateFrom, 1), 'yyyy-MM-dd')}` + `>${format(subDays(absencesFilter.dateFrom, 1), 'yyyy-MM-dd')}`, ); } if (absencesFilter.dateTo) { params = params.set( 'filter.LessonDateTimeTo', - `<${format(addDays(absencesFilter.dateTo, 1), 'yyyy-MM-dd')}` + `<${format(addDays(absencesFilter.dateTo, 1), 'yyyy-MM-dd')}`, ); } } @@ -252,21 +252,21 @@ export class LessonPresencesRestService extends RestService< if (absencesFilter.confirmationStates) { params = params.set( 'filter.ConfirmationStateId', - `;${absencesFilter.confirmationStates.join(';')}` + `;${absencesFilter.confirmationStates.join(';')}`, ); } if (absencesFilter.incidentTypes) { params = params.set( 'filter.TypeRef', - `;${absencesFilter.incidentTypes.join(';')}` + `;${absencesFilter.incidentTypes.join(';')}`, ); } if (absencesFilter.presenceTypes) { params = params.set( 'filter.TypeRef', - `;${absencesFilter.presenceTypes.join(';')}` + `;${absencesFilter.presenceTypes.join(';')}`, ); } @@ -274,8 +274,8 @@ export class LessonPresencesRestService extends RestService< params = params.set( 'filter.TypeRef', `;${absencesFilter.presenceTypes.join( - ';' - )};${absencesFilter.incidentTypes.join(';')}` + ';', + )};${absencesFilter.incidentTypes.join(';')}`, ); } @@ -289,7 +289,7 @@ export class LessonPresencesRestService extends RestService< } private getListOfUnconfirmedLessonTeacher( - params?: Dict + params?: Dict, ): Observable> { return this.getList({ headers: { 'X-Role-Restriction': 'LessonTeacherRole' }, @@ -302,7 +302,7 @@ export class LessonPresencesRestService extends RestService< } private getListOfUnconfirmedClassTeacher( - params?: Dict + params?: Dict, ): Observable> { return this.getList({ headers: { @@ -317,7 +317,7 @@ export class LessonPresencesRestService extends RestService< } private getListOfUnconfirmedAbsenceAdministrator( - params?: Dict + params?: Dict, ): Observable> { return this.getList({ headers: { 'X-Role-Restriction': 'AbsenceAdministratorRole' }, @@ -336,7 +336,7 @@ export class LessonPresencesRestService extends RestService< */ function filteredParams( filterValues: ReadonlyArray<[Option, string]>, - params = new HttpParams() + params = new HttpParams(), ): HttpParams { return filterValues.reduce((acc, [item, field]) => { if (item && field) { @@ -348,13 +348,13 @@ function filteredParams( function sortedParams( sorting: Option>, - params = new HttpParams() + params = new HttpParams(), ): HttpParams { if (!sorting) { return params; } return params.set( 'sort', - `${sorting.key}.${sorting.ascending ? 'asc' : 'desc'}` + `${sorting.key}.${sorting.ascending ? 'asc' : 'desc'}`, ); } diff --git a/src/app/shared/services/lesson-teachers-rest.service.ts b/src/app/shared/services/lesson-teachers-rest.service.ts index 54aafd892..960615f59 100644 --- a/src/app/shared/services/lesson-teachers-rest.service.ts +++ b/src/app/shared/services/lesson-teachers-rest.service.ts @@ -24,7 +24,7 @@ export class LessonTeachersRestService extends RestService< loadOtherTeachersLessonAbsences( personId: number, students: number[], - params?: HttpParams | Dict + params?: HttpParams | Dict, ): Observable> { let url = `${this.baseUrl}/except/${personId}/LessonAbsences?expand=LessonRef`; if (students && students.length > 0) { diff --git a/src/app/shared/services/loading-service.ts b/src/app/shared/services/loading-service.ts index 8c6472d7d..383efa9fa 100644 --- a/src/app/shared/services/loading-service.ts +++ b/src/app/shared/services/loading-service.ts @@ -47,9 +47,9 @@ export class LoadingService implements OnDestroy { return counts; } }, {} as LoadingCounts), - startWith({} as LoadingCounts) + startWith({} as LoadingCounts), ), - { connector: () => new ReplaySubject(1) } // Make it hot + { connector: () => new ReplaySubject(1) }, // Make it hot ); loading$ = this.loading(); @@ -66,14 +66,14 @@ export class LoadingService implements OnDestroy { return this.loadingCounts$.pipe( map((counts) => counts[context]), map(nonZero), - distinctUntilChanged() + distinctUntilChanged(), ); } load(source$: Observable, context = DEFAULT_CONTEXT): Observable { return source$.pipe( prepare(this.incrementLoadingCount(context)), - finalize(this.decrementLoadingCount(context)) + finalize(this.decrementLoadingCount(context)), ); } diff --git a/src/app/shared/services/notification-types.service.spec.ts b/src/app/shared/services/notification-types.service.spec.ts index 1893dd55b..862f7de6a 100644 --- a/src/app/shared/services/notification-types.service.spec.ts +++ b/src/app/shared/services/notification-types.service.spec.ts @@ -12,12 +12,12 @@ describe('NotificationTypesService', () => { beforeEach(() => { storageServiceMock = jasmine.createSpyObj('StorageService', ['getPayload']); storageServiceMock.getPayload = () => - ({ roles: 'StudentRole' } as TokenPayload); + ({ roles: 'StudentRole' }) as TokenPayload; TestBed.configureTestingModule( buildTestModuleMetadata({ providers: [{ provide: StorageService, useValue: storageServiceMock }], - }) + }), ); service = TestBed.inject(NotificationTypesService); }); diff --git a/src/app/shared/services/notification-types.service.ts b/src/app/shared/services/notification-types.service.ts index e73183e43..3d2208df6 100644 --- a/src/app/shared/services/notification-types.service.ts +++ b/src/app/shared/services/notification-types.service.ts @@ -18,14 +18,14 @@ export class NotificationTypesService { constructor( @Inject(SETTINGS) private settings: Settings, - private storage: StorageService + private storage: StorageService, ) {} getNotificationTypes(): ReadonlyArray { return this.getNotificationTypeKeys().map((key) => { if (!(key in this.settings.notificationTypes)) { throw new Error( - `Key '${key}' is missing in 'notificationTypes' setting` + `Key '${key}' is missing in 'notificationTypes' setting`, ); } @@ -41,8 +41,8 @@ export class NotificationTypesService { this.settings.notificationTypesAssignments.reduce( (acc, { roles, types }) => this.hasAnyRole(roles) ? [...acc, ...types] : acc, - [] as ReadonlyArray - ) + [] as ReadonlyArray, + ), ); } diff --git a/src/app/shared/services/paginated-entries.service.ts b/src/app/shared/services/paginated-entries.service.ts index fec2bd9cd..a8e883197 100644 --- a/src/app/shared/services/paginated-entries.service.ts +++ b/src/app/shared/services/paginated-entries.service.ts @@ -46,7 +46,7 @@ export const PAGE_LOADING_CONTEXT = 'page'; export abstract class PaginatedEntriesService< T, FilterValue, - SortingKey = keyof T + SortingKey = keyof T, > implements OnDestroy { loading$ = this.loadingService.loading$; @@ -58,7 +58,7 @@ export abstract class PaginatedEntriesService< validFilter$ = this.filter$.pipe( filter(this.isValidFilter.bind(this)), distinctUntilChanged(isEqual), // Only cause a reload if the filter changes - shareReplay(1) + shareReplay(1), ); private resetEntries$ = new Subject(); @@ -66,11 +66,11 @@ export abstract class PaginatedEntriesService< private page$ = merge( this.nextPage$.pipe(map(() => 'next')), merge(this.resetEntries$, this.validFilter$, this.sorting$).pipe( - map(() => 'reset') - ) + map(() => 'reset'), + ), ).pipe(scan((page, action) => (action === 'next' ? page + 1 : 0), 0)); private offset$ = this.page$.pipe( - map((page) => page * this.settings.paginationLimit) + map((page) => page * this.settings.paginationLimit), ); private pageResult$ = combineLatest([ this.validFilter$, @@ -79,13 +79,13 @@ export abstract class PaginatedEntriesService< ]).pipe( debounceTime(10), concatMap(spread(this.loadEntries.bind(this))), - shareReplay(1) + shareReplay(1), ); entries$ = merge( // Restart with empty list on reset or if filter/sorting changes merge(this.resetEntries$, this.validFilter$, this.sorting$).pipe( - map(() => ({ action: 'reset' } as ResetEntriesAction)) + map(() => ({ action: 'reset' }) as ResetEntriesAction), ), // Accumulate entries of loaded pages @@ -101,16 +101,16 @@ export abstract class PaginatedEntriesService< action: 'append', entries: result.entries, } as AppendEntriesAction; - }) - ) + }), + ), ).pipe( scan(this.entriesActionReducer.bind(this), [] as ReadonlyArray), - shareReplay(1) + shareReplay(1), ); total$ = this.pageResult$.pipe(map(({ total }) => total)); hasMore$ = this.pageResult$.pipe( - map(({ offset, total }) => offset < total - this.settings.paginationLimit) + map(({ offset, total }) => offset < total - this.settings.paginationLimit), ); queryParams$ = this.filter$.pipe(map(this.buildParamsFromFilter.bind(this))); @@ -123,7 +123,7 @@ export abstract class PaginatedEntriesService< protected loadingService: LoadingService, protected sortService: SortService, protected settings: Settings, - pageUrl: string + pageUrl: string, ) { this.queryParamsString$ .pipe(takeUntil(this.destroy$)) @@ -166,14 +166,14 @@ export abstract class PaginatedEntriesService< protected abstract loadEntries( filterValue: FilterValue, sorting: Option>, - offset: number + offset: number, ): Observable>>; protected abstract buildParamsFromFilter(filterValue: FilterValue): Params; private entriesActionReducer( entries: ReadonlyArray, - event: EntriesAction + event: EntriesAction, ): ReadonlyArray { switch (event.action) { case 'append': diff --git a/src/app/shared/services/persons-rest.service.spec.ts b/src/app/shared/services/persons-rest.service.spec.ts index a77172b9e..1e29d83a6 100644 --- a/src/app/shared/services/persons-rest.service.spec.ts +++ b/src/app/shared/services/persons-rest.service.spec.ts @@ -55,7 +55,7 @@ describe('PersonsRestService', () => { 38608, '+41 31 123 45 67', '+41 79 123 45 67', - 'john@example.com' + 'john@example.com', ) .subscribe(); @@ -67,7 +67,7 @@ describe('PersonsRestService', () => { PhonePrivate: '+41 31 123 45 67', PhoneMobile: '+41 79 123 45 67', Email2: 'john@example.com', - }) + }), ); expect().nothing(); }); @@ -81,7 +81,7 @@ describe('PersonsRestService', () => { (req) => req.method === 'GET' && req.urlWithParams === - 'https://eventotest.api/Persons/?filter.Id==4515&fields=FormOfAddress,Email' + 'https://eventotest.api/Persons/?filter.Id==4515&fields=FormOfAddress,Email', ); expect().nothing(); }); diff --git a/src/app/shared/services/persons-rest.service.ts b/src/app/shared/services/persons-rest.service.ts index 3fa41fa08..642be0f36 100644 --- a/src/app/shared/services/persons-rest.service.ts +++ b/src/app/shared/services/persons-rest.service.ts @@ -15,7 +15,7 @@ import { pick } from '../utils/types'; }) export class PersonsRestService extends RestService { protected personEmailCodec = t.type( - pick(this.codec.props, ['Email', 'FormOfAddress']) + pick(this.codec.props, ['Email', 'FormOfAddress']), ); constructor(http: HttpClient, @Inject(SETTINGS) settings: Settings) { @@ -23,7 +23,7 @@ export class PersonsRestService extends RestService { } getListForIds( - personIds: ReadonlyArray + personIds: ReadonlyArray, ): Observable> { return this.getList({ params: { 'filter.Id': `;${personIds.join(';')}` } }); } @@ -44,7 +44,7 @@ export class PersonsRestService extends RestService { }) .pipe( switchMap(decodeArray(this.personEmailCodec)), - map((person) => person[0]) + map((person) => person[0]), ); } @@ -52,7 +52,7 @@ export class PersonsRestService extends RestService { personId: number, phonePrivate: Option, phoneMobile: Option, - email2: Maybe + email2: Maybe, ): Observable { const body = { PhonePrivate: phonePrivate, diff --git a/src/app/shared/services/presence-types-rest.service.spec.ts b/src/app/shared/services/presence-types-rest.service.spec.ts index a396ae51a..e2bacfec4 100644 --- a/src/app/shared/services/presence-types-rest.service.spec.ts +++ b/src/app/shared/services/presence-types-rest.service.spec.ts @@ -8,7 +8,7 @@ describe('PresenceTypesRestService', () => { it('should be created', () => { const service: PresenceTypesRestService = TestBed.inject( - PresenceTypesRestService + PresenceTypesRestService, ); expect(service).toBeTruthy(); }); diff --git a/src/app/shared/services/reports.service.spec.ts b/src/app/shared/services/reports.service.spec.ts index d22919181..8f3f8edb8 100644 --- a/src/app/shared/services/reports.service.spec.ts +++ b/src/app/shared/services/reports.service.spec.ts @@ -25,7 +25,7 @@ describe('ReportsService', () => { }, }, ], - }) + }), ); service = TestBed.inject(ReportsService); httpTestingController = TestBed.inject(HttpTestingController); @@ -46,7 +46,7 @@ describe('ReportsService', () => { .expectOne( (req) => req.urlWithParams === - 'https://eventotest.api/CrystalReports/AvailableReports/Person?ids=290026&keys=42' + 'https://eventotest.api/CrystalReports/AvailableReports/Person?ids=290026&keys=42', ) .flush({ Id: 290026 }); @@ -58,7 +58,7 @@ describe('ReportsService', () => { .expectOne( (req) => req.urlWithParams === - 'https://eventotest.api/CrystalReports/AvailableReports/Person?ids=290026&keys=42' + 'https://eventotest.api/CrystalReports/AvailableReports/Person?ids=290026&keys=42', ) .flush(null); @@ -69,7 +69,7 @@ describe('ReportsService', () => { describe('getPersonMasterDataUrl', () => { it('returns the report url', () => { expect(service.getPersonMasterDataUrl(123)).toBe( - 'https://eventotest.api/Files/CrystalReports/Person/290026?ids=123&token=SOMETOKEN' + 'https://eventotest.api/Files/CrystalReports/Person/290026?ids=123&token=SOMETOKEN', ); }); }); @@ -92,7 +92,7 @@ describe('ReportsService', () => { .expectOne( (req) => req.urlWithParams === - 'https://eventotest.api/CrystalReports/AvailableReports/Praesenzinformation?ids=290036&keys=123_456,456_789' + 'https://eventotest.api/CrystalReports/AvailableReports/Praesenzinformation?ids=290036&keys=123_456,456_789', ) .flush({ Id: 290036 }); @@ -104,7 +104,7 @@ describe('ReportsService', () => { .expectOne( (req) => req.urlWithParams === - 'https://eventotest.api/CrystalReports/AvailableReports/Praesenzinformation?ids=290036&keys=123_456,456_789' + 'https://eventotest.api/CrystalReports/AvailableReports/Praesenzinformation?ids=290036&keys=123_456,456_789', ) .flush(null); @@ -115,7 +115,7 @@ describe('ReportsService', () => { describe('getStudentConfirmationUrl', () => { it('returns the report url', () => { expect(service.getStudentConfirmationUrl(['123_456', '789_012'])).toBe( - 'https://eventotest.api/Files/CrystalReports/Praesenzinformation/290036?ids=123_456,789_012&token=SOMETOKEN' + 'https://eventotest.api/Files/CrystalReports/Praesenzinformation/290036?ids=123_456,789_012&token=SOMETOKEN', ); }); }); @@ -124,7 +124,7 @@ describe('ReportsService', () => { describe('Auswertung der Absenzen', () => { it('returns the report url', () => { expect(service.getEvaluateAbsencesUrl(['123_456', '789_012'])).toBe( - 'https://eventotest.api/Files/CrystalReports/Praesenzinformation/290048?ids=123_456,789_012&token=SOMETOKEN' + 'https://eventotest.api/Files/CrystalReports/Praesenzinformation/290048?ids=123_456,789_012&token=SOMETOKEN', ); }); }); @@ -132,7 +132,7 @@ describe('ReportsService', () => { describe('Auswertung Events', () => { it('returns the report url', () => { expect(service.getEventReportUrl(123)).toBe( - 'https://eventotest.api/Files/CrystalReports/Anlass/290044?ids=123&token=SOMETOKEN' + 'https://eventotest.api/Files/CrystalReports/Anlass/290044?ids=123&token=SOMETOKEN', ); }); }); @@ -140,7 +140,7 @@ describe('ReportsService', () => { describe('Subscription Report Url', () => { it('returns the report url', () => { expect(service.getSubscriptionReportUrl(123, [11, 12, 13])).toBe( - `https://eventotest.api/Files/CrystalReports/Anmeldung/123?ids=11,12,13&token=SOMETOKEN` + `https://eventotest.api/Files/CrystalReports/Anmeldung/123?ids=11,12,13&token=SOMETOKEN`, ); }); }); diff --git a/src/app/shared/services/reports.service.ts b/src/app/shared/services/reports.service.ts index 6fc34dbbd..ffbfcf56a 100644 --- a/src/app/shared/services/reports.service.ts +++ b/src/app/shared/services/reports.service.ts @@ -56,14 +56,14 @@ export class ReportsService implements OnDestroy { personMasterDataAvailability$ = this.loadReportAvailability( 'Person', this.settings.personMasterDataReportId, - [Number(this.storageService.getPayload()?.id_person)] + [Number(this.storageService.getPayload()?.id_person)], ).pipe(shareReplay(1)); studentConfirmationAvailability$ = this.loadReportAvailabilityByAsyncRecordIds( 'Praesenzinformation', this.settings.studentConfirmationReportId, - this.studentConfirmationAvailabilityRecordIds$ + this.studentConfirmationAvailabilityRecordIds$, ); private studentConfirmationAvailabilitySub: Subscription; @@ -72,7 +72,7 @@ export class ReportsService implements OnDestroy { @Inject(SETTINGS) private settings: Settings, private storageService: StorageService, private subscriptionService: SubscriptionsRestService, - private http: HttpClient + private http: HttpClient, ) { this.studentConfirmationAvailabilitySub = this.studentConfirmationAvailability$.connect(); @@ -101,7 +101,7 @@ export class ReportsService implements OnDestroy { return this.getReportUrl( 'Praesenzinformation', this.settings.studentConfirmationReportId, - recordIds + recordIds, ); } @@ -115,7 +115,7 @@ export class ReportsService implements OnDestroy { return this.getReportUrl( 'Praesenzinformation', this.settings.evaluateAbsencesReportId, - recordIds + recordIds, ); } @@ -131,7 +131,7 @@ export class ReportsService implements OnDestroy { getSubscriptionReportUrl( settingReportId: number, - idSubscriptionIds: number[] + idSubscriptionIds: number[], ): string { return `${ this.settings.apiUrl @@ -139,7 +139,7 @@ export class ReportsService implements OnDestroy { } setStudentConfirmationAvailabilityRecordIds( - recordIds: ReadonlyArray + recordIds: ReadonlyArray, ): void { this.studentConfirmationAvailabilityRecordIds$.next(recordIds); } @@ -147,27 +147,27 @@ export class ReportsService implements OnDestroy { private getReportUrl( context: string, reportId: number, - recordIds: ReadonlyArray + recordIds: ReadonlyArray, ): string { return `${ this.settings.apiUrl }/Files/CrystalReports/${context}/${reportId}?ids=${recordIds.join( - ',' + ',', )}&token=${this.storageService.getAccessToken()}`; } private loadReportAvailability( context: string, reportId: number, - recordIds: ReadonlyArray + recordIds: ReadonlyArray, ): Observable { return this.http .get( `${ this.settings.apiUrl }/CrystalReports/AvailableReports/${context}?ids=${reportId}&keys=${recordIds.join( - ',' - )}` + ',', + )}`, ) .pipe(map(notNull), startWith(false), distinctUntilChanged()); } @@ -175,16 +175,16 @@ export class ReportsService implements OnDestroy { private loadReportAvailabilityByAsyncRecordIds( context: string, reportId: number, - recordIds$: Observable> + recordIds$: Observable>, ): Connectable { return connectable( recordIds$.pipe( filter((_, i) => i === 0), // Fetch the availability only once and cache it afterwards (but don't complete) switchMap((recordIds) => - this.loadReportAvailability(context, reportId, recordIds) - ) + this.loadReportAvailability(context, reportId, recordIds), + ), ), - { connector: () => new ReplaySubject(1) } + { connector: () => new ReplaySubject(1) }, ); } } diff --git a/src/app/shared/services/rest.service.spec.ts b/src/app/shared/services/rest.service.spec.ts index caaf3e25c..0fb82f913 100644 --- a/src/app/shared/services/rest.service.spec.ts +++ b/src/app/shared/services/rest.service.spec.ts @@ -27,7 +27,7 @@ describe('RestService', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ providers: [FooService], - }) + }), ); service = TestBed.inject(FooService); httpTestingController = TestBed.inject(HttpTestingController); @@ -60,8 +60,8 @@ describe('RestService', () => { expect(error).toHaveBeenCalledWith( new DecodeError( - 'Invalid value 123 supplied to : { foo: string }/foo: string' - ) + 'Invalid value 123 supplied to : { foo: string }/foo: string', + ), ); }); }); @@ -91,8 +91,8 @@ describe('RestService', () => { expect(error).toHaveBeenCalledWith( new DecodeError( - 'Invalid value 123 supplied to : Array<{ foo: string }>/0: { foo: string }/foo: string' - ) + 'Invalid value 123 supplied to : Array<{ foo: string }>/0: { foo: string }/foo: string', + ), ); }); }); diff --git a/src/app/shared/services/scroll-position.service.spec.ts b/src/app/shared/services/scroll-position.service.spec.ts index 3b86db7a4..003d0c727 100644 --- a/src/app/shared/services/scroll-position.service.spec.ts +++ b/src/app/shared/services/scroll-position.service.spec.ts @@ -8,7 +8,7 @@ describe('ScrollPositionService', () => { it('should be created', () => { const service: ScrollPositionService = TestBed.inject( - ScrollPositionService + ScrollPositionService, ); expect(service).toBeTruthy(); }); diff --git a/src/app/shared/services/selection.service.ts b/src/app/shared/services/selection.service.ts index 60052cd42..d37648b6a 100644 --- a/src/app/shared/services/selection.service.ts +++ b/src/app/shared/services/selection.service.ts @@ -31,9 +31,9 @@ export abstract class SelectionService implements OnDestroy { selection$ = connectable( this.action$.pipe( scan(this.reduceSelection.bind(this), [] as ReadonlyArray), - startWith([] as ReadonlyArray) + startWith([] as ReadonlyArray), ), - { connector: () => new ReplaySubject>(1) } // Make it hot + { connector: () => new ReplaySubject>(1) }, // Make it hot ); private selectionSub: Subscription; @@ -63,13 +63,13 @@ export abstract class SelectionService implements OnDestroy { isSelected$(entry: T): Observable { return this.selection$.pipe( map((selection) => selection.includes(entry)), - distinctUntilChanged() + distinctUntilChanged(), ); } private reduceSelection( selection: ReadonlyArray, - action: SelectionAction + action: SelectionAction, ): ReadonlyArray { switch (action.type) { case SelectionActionTypes.ToggleSelection: diff --git a/src/app/shared/services/sort.service.ts b/src/app/shared/services/sort.service.ts index 0e24f26c6..476e11771 100644 --- a/src/app/shared/services/sort.service.ts +++ b/src/app/shared/services/sort.service.ts @@ -19,12 +19,12 @@ export interface Sorting { }) export class SortService { private sortingSubject$ = new BehaviorSubject>>( - null + null, ); sorting$ = this.sortingSubject$.asObservable().pipe( distinctUntilChanged(isEqual), // Only cause a reload if the sorting changes - shareReplay(1) + shareReplay(1), ); getSortingChar$(key: SortingKey): Observable { @@ -34,7 +34,7 @@ export class SortService { return sorting.ascending ? '↓' : '↑'; } return ''; - }) + }), ); } diff --git a/src/app/shared/services/student-profile-absences.service.spec.ts b/src/app/shared/services/student-profile-absences.service.spec.ts index 8aa0e1a90..992ed9e0e 100644 --- a/src/app/shared/services/student-profile-absences.service.spec.ts +++ b/src/app/shared/services/student-profile-absences.service.spec.ts @@ -10,7 +10,7 @@ describe('StudentProfileAbsencesService', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ providers: [StudentProfileAbsencesService], - }) + }), ); service = TestBed.inject(StudentProfileAbsencesService); }); diff --git a/src/app/shared/services/student-profile-absences.service.ts b/src/app/shared/services/student-profile-absences.service.ts index 6418327ea..73f2888dc 100644 --- a/src/app/shared/services/student-profile-absences.service.ts +++ b/src/app/shared/services/student-profile-absences.service.ts @@ -36,7 +36,7 @@ export class StudentProfileAbsencesService { private lessonPresencesService: LessonPresencesRestService, private presenceTypesService: PresenceTypesService, private toastService: ToastService, - private translate: TranslateService + private translate: TranslateService, ) {} setStudentId(id: number): void { @@ -45,8 +45,8 @@ export class StudentProfileAbsencesService { private getAbsences( loadFn: ( - studentId: number - ) => Observable>> + studentId: number, + ) => Observable>>, ): Observable>> { return this.studentId$.pipe( switchMap(loadFn), @@ -55,7 +55,7 @@ export class StudentProfileAbsencesService { share({ connector: () => new ReplaySubject>>(1), - }) + }), ); } @@ -66,7 +66,7 @@ export class StudentProfileAbsencesService { this.loadStatistics(studentId).pipe(startWith(null)), this.openAbsences$.pipe(map((absences) => absences?.length ?? null)), this.checkableAbsences$.pipe( - map((absences) => absences?.length ?? null) + map((absences) => absences?.length ?? null), ), ]); }), @@ -77,18 +77,18 @@ export class StudentProfileAbsencesService { unexcusedAbsences: statistics?.TotalAbsencesWithoutExcuse ?? null, incidents: statistics?.TotalIncidents ?? null, halfDays: statistics?.TotalHalfDays ?? null, - })) + })), ); } private loadStatistics( - studentId: number + studentId: number, ): Observable { return this.lessonPresencesService .getStatistics( { student: studentId, educationalEvent: null, studyClass: null }, null, - 0 + 0, ) .pipe( switchMap(({ entries }) => { @@ -97,23 +97,23 @@ export class StudentProfileAbsencesService { } this.toastService.error( this.translate.instant(`global.rest-errors.notfound-message`), - this.translate.instant(`global.rest-errors.notfound-title`) + this.translate.instant(`global.rest-errors.notfound-title`), ); return EMPTY; - }) + }), ); } private loadOpenAbsences( - studentId: number + studentId: number, ): Observable> { return this.lessonPresencesService.getListOfUnconfirmed( - this.getBaseParams(studentId) + this.getBaseParams(studentId), ); } private loadCheckableAbsences( - studentId: number + studentId: number, ): Observable> { return this.lessonPresencesService.getList({ params: { @@ -124,7 +124,7 @@ export class StudentProfileAbsencesService { } private loadExcusedAbsences( - studentId: number + studentId: number, ): Observable> { return this.lessonPresencesService.getList({ params: { @@ -135,7 +135,7 @@ export class StudentProfileAbsencesService { } private loadUnexcusedAbsences( - studentId: number + studentId: number, ): Observable> { return this.lessonPresencesService.getList({ params: { @@ -146,19 +146,19 @@ export class StudentProfileAbsencesService { } private loadIncidents( - studentId: number + studentId: number, ): Observable> { return this.presenceTypesService.incidentTypes$.pipe( map((incidents) => ({ ...this.getBaseParams(studentId), 'filter.TypeRef': `;${incidents.map((i) => i.Id).join(';')}`, })), - switchMap((params) => this.lessonPresencesService.getList({ params })) + switchMap((params) => this.lessonPresencesService.getList({ params })), ); } private loadHalfDays( - studentId: number + studentId: number, ): Observable> { return this.lessonPresencesService.getList({ params: { diff --git a/src/app/shared/services/student-profile.service.spec.ts b/src/app/shared/services/student-profile.service.spec.ts index e8b639356..3c47ad2d4 100644 --- a/src/app/shared/services/student-profile.service.spec.ts +++ b/src/app/shared/services/student-profile.service.spec.ts @@ -58,21 +58,21 @@ describe('StudentProfileService', () => { apprenticeshipContract = buildApprenticeshipContract( student.Id, 35468, - 38223 + 38223, ); legalRepresentative1 = buildPerson( - legalRepresentatives[0].RepresentativeId + legalRepresentatives[0].RepresentativeId, ); legalRepresentative2 = buildPersonWithEmails( legalRepresentatives[1].RepresentativeId, - 'display@email.ch' + 'display@email.ch', ); jobTrainer = buildJobTrainerWithEmails(35468, 'email1@email.ch'); apprenticeshipManager = buildApprenticeshipManagerWithEmails( 38223, 'email1@email.ch', - 'email2@email.ch' + 'email2@email.ch', ); persons = [legalRepresentative1, legalRepresentative2]; @@ -109,7 +109,7 @@ describe('StudentProfileService', () => { expectApprenticeshipContractRequest(student.Id); expectPersonsRequest(persons.map((person) => person.Id)); expectApprenticeshipManagerRequest( - apprenticeshipContract.ApprenticeshipManagerId + apprenticeshipContract.ApprenticeshipManagerId, ); if (apprenticeshipContract.JobTrainer) { expectJobTrainerRequest(apprenticeshipContract.JobTrainer); @@ -128,7 +128,7 @@ describe('StudentProfileService', () => { expectLegalRepresentativesRequest(student.Id); expectApprenticeshipContractRequest(student.Id); expectApprenticeshipManagerRequest( - apprenticeshipContract.ApprenticeshipManagerId + apprenticeshipContract.ApprenticeshipManagerId, ); if (apprenticeshipContract.JobTrainer) { expectJobTrainerRequest(apprenticeshipContract.JobTrainer); @@ -151,7 +151,7 @@ describe('StudentProfileService', () => { expectApprenticeshipContractRequest(student.Id); expectPersonsRequest([legalRepresentatives[0].RepresentativeId]); expectApprenticeshipManagerRequest( - apprenticeshipContract.ApprenticeshipManagerId + apprenticeshipContract.ApprenticeshipManagerId, ); if (apprenticeshipContract.JobTrainer) { expectJobTrainerRequest(apprenticeshipContract.JobTrainer); @@ -184,7 +184,7 @@ describe('StudentProfileService', () => { expectLoadStayPermitValueRequest(); expectPersonsRequest(persons.map((person) => person.Id)); expectApprenticeshipManagerRequest( - apprenticeshipContract.ApprenticeshipManagerId + apprenticeshipContract.ApprenticeshipManagerId, ); if (apprenticeshipContract.JobTrainer) { expectJobTrainerRequest(apprenticeshipContract.JobTrainer); @@ -202,7 +202,7 @@ describe('StudentProfileService', () => { expectApprenticeshipContractRequest(myself.Id); expectLoadStayPermitValueRequest(); expectApprenticeshipManagerRequest( - apprenticeshipContract.ApprenticeshipManagerId + apprenticeshipContract.ApprenticeshipManagerId, ); if (apprenticeshipContract.JobTrainer) { expectJobTrainerRequest(apprenticeshipContract.JobTrainer); @@ -224,7 +224,7 @@ describe('StudentProfileService', () => { expectLoadStayPermitValueRequest(); expectPersonsRequest([legalRepresentatives[0].RepresentativeId]); expectApprenticeshipManagerRequest( - apprenticeshipContract.ApprenticeshipManagerId + apprenticeshipContract.ApprenticeshipManagerId, ); if (apprenticeshipContract.JobTrainer) { expectJobTrainerRequest(apprenticeshipContract.JobTrainer); @@ -244,7 +244,7 @@ describe('StudentProfileService', () => { function expectLegalRepresentativesRequest( id: number, - response = legalRepresentatives + response = legalRepresentatives, ): void { const url = `https://eventotest.api/Students/${id}/LegalRepresentatives`; httpTestingController @@ -269,7 +269,7 @@ describe('StudentProfileService', () => { function expectPersonsRequest(personIds: number[], response = persons): void { const url = `https://eventotest.api/Persons/?filter.Id=;${personIds.join( - ';' + ';', )}`; httpTestingController diff --git a/src/app/shared/services/student-profile.service.ts b/src/app/shared/services/student-profile.service.ts index a909926ef..26db1db10 100644 --- a/src/app/shared/services/student-profile.service.ts +++ b/src/app/shared/services/student-profile.service.ts @@ -45,7 +45,7 @@ export class StudentProfileService { private apprenticeshipManagersService: ApprenticeshipManagersRestService, private jobTrainersService: JobTrainersRestService, private loadingService: LoadingService, - private dropDownItemsService: DropDownItemsRestService + private dropDownItemsService: DropDownItemsRestService, ) {} /** @@ -57,7 +57,7 @@ export class StudentProfileService { this.loadStudent(studentId), this.loadLegalRepresentatives(studentId), this.loadApprenticeshipContracts(studentId), - ]).pipe(switchMap(spread(this.mapToProfile.bind(this)))) + ]).pipe(switchMap(spread(this.mapToProfile.bind(this)))), ); } @@ -75,13 +75,13 @@ export class StudentProfileService { this.loadLegalRepresentatives(person.Id), this.loadApprenticeshipContracts(person.Id), this.loadStayPermitValue(person.StayPermit), - ]) - ) + ]), + ), ) .pipe( switchMap(spread(this.mapToProfile.bind(this))), - filter(notNull) // For (type-)safety, should never be null - ) + filter(notNull), // For (type-)safety, should never be null + ), ); } @@ -92,18 +92,18 @@ export class StudentProfileService { } private loadLegalRepresentatives( - id: number + id: number, ): Observable> { return this.studentService.getLegalRepresentatives(id); } private loadApprenticeshipContracts( - id: number + id: number, ): Observable> { return this.studentService .getCurrentApprenticeshipContracts( id, - withConfig({ disableErrorHandlingForStatus: [404] }) + withConfig({ disableErrorHandlingForStatus: [404] }), ) .pipe(catch404([])); } @@ -118,7 +118,7 @@ export class StudentProfileService { student: Option, legalRepresentatives: ReadonlyArray, apprenticeshipContracts: ReadonlyArray, - stayPermitValue: Option = null + stayPermitValue: Option = null, ): Observable>> { if (!student) { return of(null); @@ -126,7 +126,7 @@ export class StudentProfileService { legalRepresentatives = this.getRelevantLegalRepresentatives( student, - legalRepresentatives + legalRepresentatives, ); return combineLatest([ @@ -142,26 +142,26 @@ export class StudentProfileService { persons, apprenticeshipContracts, managers, - trainers - ) - ) + trainers, + ), + ), ); } private loadLegalRepresentativPersons( - legalRepresentatives: ReadonlyArray + legalRepresentatives: ReadonlyArray, ): Observable> { if (legalRepresentatives.length === 0) { return of([]); } return this.personsService.getListForIds( - legalRepresentatives.map((r) => r.RepresentativeId) + legalRepresentatives.map((r) => r.RepresentativeId), ); } private loadJobTrainers( - contracts: ReadonlyArray + contracts: ReadonlyArray, ): Observable> { const ids = contracts .map((contract) => contract.JobTrainer) @@ -175,7 +175,7 @@ export class StudentProfileService { } private loadApprenticeshipManagers( - contracts: ReadonlyArray + contracts: ReadonlyArray, ): Observable> { const ids = contracts.map((contract) => contract.ApprenticeshipManagerId); @@ -184,7 +184,7 @@ export class StudentProfileService { } return combineLatest( - ids.map((id) => this.apprenticeshipManagersService.get(id)) + ids.map((id) => this.apprenticeshipManagersService.get(id)), ); } @@ -195,7 +195,7 @@ export class StudentProfileService { legalRepresentativePersons: ReadonlyArray, apprenticeshipContracts: ReadonlyArray, apprenticeshipManagers: ReadonlyArray, - jobTrainers: ReadonlyArray + jobTrainers: ReadonlyArray, ): Profile { const profile: Profile = { student, @@ -204,16 +204,16 @@ export class StudentProfileService { .map((legalRepresentative) => this.findPerson( legalRepresentative.RepresentativeId, - legalRepresentativePersons - ) + legalRepresentativePersons, + ), ) .filter(notNull), apprenticeshipCompanies: apprenticeshipContracts.map((contract) => this.createApprenticeshipCompany( contract, apprenticeshipManagers, - jobTrainers - ) + jobTrainers, + ), ), }; return profile; @@ -221,25 +221,25 @@ export class StudentProfileService { private getRelevantLegalRepresentatives( person: T, - legalRepresentatives: ReadonlyArray + legalRepresentatives: ReadonlyArray, ): ReadonlyArray { const adult = isAdult(person); return legalRepresentatives.filter( - (representative) => !adult || representative.RepresentativeAfterMajority + (representative) => !adult || representative.RepresentativeAfterMajority, ); } private createApprenticeshipCompany( contract: ApprenticeshipContract, managers: ReadonlyArray, - trainers: ReadonlyArray + trainers: ReadonlyArray, ): ApprenticeshipCompany { const apprenticeshipCompany: ApprenticeshipCompany = { apprenticeshipContract: contract, jobTrainer: this.findPerson(contract.JobTrainer, trainers), apprenticeshipManager: this.findPerson( contract.ApprenticeshipManagerId, - managers + managers, ), }; return apprenticeshipCompany; @@ -247,7 +247,7 @@ export class StudentProfileService { private findPerson( id: Maybe, - persons: ReadonlyArray + persons: ReadonlyArray, ): Option { return id ? persons.find((p) => p.Id === id) || null : null; } diff --git a/src/app/shared/services/students-rest.service.spec.ts b/src/app/shared/services/students-rest.service.spec.ts index f6eea0227..c78e75afe 100644 --- a/src/app/shared/services/students-rest.service.spec.ts +++ b/src/app/shared/services/students-rest.service.spec.ts @@ -49,7 +49,7 @@ describe('StudentsRestService', () => { httpTestingController .expectOne( - 'https://eventotest.api/Students/39361/ApprenticeshipContracts/Current' + 'https://eventotest.api/Students/39361/ApprenticeshipContracts/Current', ) .flush([ buildApprenticeshipContract(55905), diff --git a/src/app/shared/services/students-rest.service.ts b/src/app/shared/services/students-rest.service.ts index 813a5cce9..5e73829dc 100644 --- a/src/app/shared/services/students-rest.service.ts +++ b/src/app/shared/services/students-rest.service.ts @@ -24,7 +24,7 @@ export class StudentsRestService extends TypeaheadRestService { getLegalRepresentatives( studentId: number, - params?: HttpParams | Dict + params?: HttpParams | Dict, ): Observable> { return this.http .get(`${this.baseUrl}/${studentId}/LegalRepresentatives`, { @@ -35,21 +35,21 @@ export class StudentsRestService extends TypeaheadRestService { getCurrentApprenticeshipContracts( studentId: number, - params?: HttpParams | Dict + params?: HttpParams | Dict, ): Observable> { return this.http .get( `${this.baseUrl}/${studentId}/ApprenticeshipContracts/Current`, { params, - } + }, ) .pipe(switchMap(decodeArray(ApprenticeshipContract))); } getLessonAbsences( studentId: number, - params?: HttpParams | Dict + params?: HttpParams | Dict, ): Observable> { return this.http .get(`${this.baseUrl}/${studentId}/LessonAbsences`, { @@ -60,7 +60,7 @@ export class StudentsRestService extends TypeaheadRestService { getLessonIncidents( studentId: number, - params?: HttpParams | Dict + params?: HttpParams | Dict, ): Observable> { return this.http .get(`${this.baseUrl}/${studentId}/LessonIncidents`, { @@ -71,7 +71,7 @@ export class StudentsRestService extends TypeaheadRestService { getLessonDispensations( studentId: number, - params?: HttpParams | Dict + params?: HttpParams | Dict, ): Observable> { return this.http .get(`${this.baseUrl}/${studentId}/LessonDispensations`, { @@ -82,14 +82,14 @@ export class StudentsRestService extends TypeaheadRestService { getTimetableEntries( studentId: number, - params?: HttpParams | Dict + params?: HttpParams | Dict, ): Observable> { return this.http .get( `${this.baseUrl}/${studentId}/TimetableEntries/CurrentSemester`, { params, - } + }, ) .pipe(switchMap(decodeArray(TimetableEntry))); } diff --git a/src/app/shared/services/study-classes-rest.service.spec.ts b/src/app/shared/services/study-classes-rest.service.spec.ts index 8a7d2ced1..a80b59ee1 100644 --- a/src/app/shared/services/study-classes-rest.service.spec.ts +++ b/src/app/shared/services/study-classes-rest.service.spec.ts @@ -28,7 +28,7 @@ describe('StudyClassesRestService', () => { (req) => req.url === 'https://eventotest.api/StudyClasses/FormativeAssessments?filter.IsActive==true' && - req.headers.get('X-Role-Restriction') === 'ClassTeacherRole' + req.headers.get('X-Role-Restriction') === 'ClassTeacherRole', ) .flush([]); }); @@ -45,7 +45,7 @@ describe('StudyClassesRestService', () => { (req) => req.url === 'https://eventotest.api/StudyClasses/?filter.IsActive==true' && - req.headers.get('X-Role-Restriction') === 'ClassTeacherRole' + req.headers.get('X-Role-Restriction') === 'ClassTeacherRole', ) .flush([]); }); diff --git a/src/app/shared/services/study-classes-rest.service.ts b/src/app/shared/services/study-classes-rest.service.ts index 5c0ad184b..5004f0a42 100644 --- a/src/app/shared/services/study-classes-rest.service.ts +++ b/src/app/shared/services/study-classes-rest.service.ts @@ -31,7 +31,7 @@ export class StudyClassesRestService extends TypeaheadRestService< `${this.baseUrl}/FormativeAssessments?filter.IsActive==true`, { headers: { 'X-Role-Restriction': 'ClassTeacherRole' }, - } + }, ) .pipe(switchMap(decodeArray(StudyClass))); } diff --git a/src/app/shared/services/subscription-details-rest.service.spec.ts b/src/app/shared/services/subscription-details-rest.service.spec.ts index 17ba68c27..069e21552 100644 --- a/src/app/shared/services/subscription-details-rest.service.spec.ts +++ b/src/app/shared/services/subscription-details-rest.service.spec.ts @@ -35,7 +35,7 @@ describe('SubscriptionDetailsRestService', () => { httpTestingController .expectOne( ({ urlWithParams }) => urlWithParams === expectedUrl, - expectedUrl + expectedUrl, ) .flush(data); @@ -61,7 +61,7 @@ describe('SubscriptionDetailsRestService', () => { .expectOne( (req) => req.url === url && req.method === 'PUT' && isEqual(req.body, body), - url + url, ) .flush(body); httpTestingController.verify(); @@ -83,7 +83,7 @@ describe('SubscriptionDetailsRestService', () => { .expectOne( (req) => req.url === url && req.method === 'PUT' && isEqual(req.body, body), - url + url, ) .flush(body); httpTestingController.verify(); diff --git a/src/app/shared/services/subscription-details-rest.service.ts b/src/app/shared/services/subscription-details-rest.service.ts index 79d924123..2db723c79 100644 --- a/src/app/shared/services/subscription-details-rest.service.ts +++ b/src/app/shared/services/subscription-details-rest.service.ts @@ -18,14 +18,14 @@ export class SubscriptionDetailsRestService extends RestService< } getListForEvent( - eventId: number + eventId: number, ): Observable> { return this.getList({ params: { IdEvent: String(eventId) } }); } update( group: GroupOptions['id'], - detail: SubscriptionDetail + detail: SubscriptionDetail, ): Observable { const body = { IdPerson: detail.IdPerson, diff --git a/src/app/shared/services/subscriptions-rest.service.ts b/src/app/shared/services/subscriptions-rest.service.ts index 462ffc474..9b9b7ccbb 100644 --- a/src/app/shared/services/subscriptions-rest.service.ts +++ b/src/app/shared/services/subscriptions-rest.service.ts @@ -22,11 +22,11 @@ export class SubscriptionsRestService extends RestService< getIdSubscriptionsByStudentAndCourse( personId: number, - eventIds: number[] + eventIds: number[], ): Observable> { return this.http .get( - `${this.settings.apiUrl}/Subscriptions/?filter.PersonId==${personId}&filter.EventId=;${eventIds}` + `${this.settings.apiUrl}/Subscriptions/?filter.PersonId==${personId}&filter.EventId=;${eventIds}`, ) .pipe(switchMap(decodeArray(IdSubscription))); } diff --git a/src/app/shared/services/teacher-resources-rest.service.ts b/src/app/shared/services/teacher-resources-rest.service.ts index aad237bae..33f1b3d38 100644 --- a/src/app/shared/services/teacher-resources-rest.service.ts +++ b/src/app/shared/services/teacher-resources-rest.service.ts @@ -21,7 +21,7 @@ export class TeacherResourcesRestService extends TypeaheadRestService< TeacherResource, 'TeacherResources', 'FullName', - 'FullName' + 'FullName', ); } @@ -40,7 +40,7 @@ export class TeacherResourcesRestService extends TypeaheadRestService< Key: items[0].FullName, Value: `${items[0].FullName}`, }); - }) + }), ); } } diff --git a/src/app/shared/services/toast.service.spec.ts b/src/app/shared/services/toast.service.spec.ts index 2c8365cb7..bdd868e5f 100644 --- a/src/app/shared/services/toast.service.spec.ts +++ b/src/app/shared/services/toast.service.spec.ts @@ -13,7 +13,7 @@ describe('ToastService', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ providers: [ToastService], - }) + }), ); service = TestBed.inject(ToastService); service.toasts$.subscribe(callback); diff --git a/src/app/shared/services/toast.service.ts b/src/app/shared/services/toast.service.ts index 838444417..3415f3056 100644 --- a/src/app/shared/services/toast.service.ts +++ b/src/app/shared/services/toast.service.ts @@ -60,15 +60,15 @@ export class ToastService { toasts.find( (existingToast) => existingToast.message === toast.message && - existingToast.header === toast.header - ) + existingToast.header === toast.header, + ), ); } private updateToasts( update: ( - existingToasts: ReadonlyArray - ) => Array | undefined + existingToasts: ReadonlyArray, + ) => Array | undefined, ): void { this.toasts$.pipe(take(1)).subscribe((existingToasts) => { const newToasts = update(existingToasts); diff --git a/src/app/shared/services/user-settings-rest.service.spec.ts b/src/app/shared/services/user-settings-rest.service.spec.ts index 5019279e2..df20287fb 100644 --- a/src/app/shared/services/user-settings-rest.service.spec.ts +++ b/src/app/shared/services/user-settings-rest.service.spec.ts @@ -41,7 +41,7 @@ describe('UserSettingsRestService', () => { }, ], HRef: null, - }) + }), ); expect().nothing(); diff --git a/src/app/shared/services/user-settings.service.spec.ts b/src/app/shared/services/user-settings.service.spec.ts index 821d887f3..323119cec 100644 --- a/src/app/shared/services/user-settings.service.spec.ts +++ b/src/app/shared/services/user-settings.service.spec.ts @@ -19,7 +19,7 @@ describe('UserSettingsService', () => { TestBed.configureTestingModule( buildTestModuleMetadata({ providers: [UserSettingsRestService], - }) + }), ); service = TestBed.inject(UserSettingsService); httpTestingController = TestBed.inject(HttpTestingController); @@ -91,7 +91,7 @@ describe('UserSettingsService', () => { }); function expectReadRequest( - mockResponse: UserSettings['Settings'] = [] + mockResponse: UserSettings['Settings'] = [], ): void { const url = 'https://eventotest.api/UserSettings/Cst'; httpTestingController @@ -100,7 +100,7 @@ describe('UserSettingsService', () => { } function expectWriteRequest( - expectedRequest: UserSettings['Settings'] = [] + expectedRequest: UserSettings['Settings'] = [], ): void { const url = 'https://eventotest.api/UserSettings/Cst'; httpTestingController @@ -108,7 +108,7 @@ describe('UserSettingsService', () => { (req) => req.url === url && req.method === 'PATCH' && - isEqual(req.body, buildUserSettings(expectedRequest)) + isEqual(req.body, buildUserSettings(expectedRequest)), ) .flush('{}'); } diff --git a/src/app/shared/tokens/dom-apis.ts b/src/app/shared/tokens/dom-apis.ts index aea36c7d0..1f9ad1e19 100644 --- a/src/app/shared/tokens/dom-apis.ts +++ b/src/app/shared/tokens/dom-apis.ts @@ -5,5 +5,5 @@ export const NAVIGATOR: InjectionToken = new InjectionToken( { providedIn: 'root', factory: (): Navigator => navigator, - } + }, ); diff --git a/src/app/shared/utils/date.spec.ts b/src/app/shared/utils/date.spec.ts index 0d1ece888..adf3535c9 100644 --- a/src/app/shared/utils/date.spec.ts +++ b/src/app/shared/utils/date.spec.ts @@ -33,7 +33,7 @@ describe('date utils', () => { describe('.formatISOLocalDateTime', () => { it('returns the given date formatted as iso string without timezone', () => { const dateString = formatISOLocalDateTime( - new Date('2019-08-17T11:02:00') + new Date('2019-08-17T11:02:00'), ); expect(dateString).toEqual('2019-08-17T11:02:00'); }); diff --git a/src/app/shared/utils/date.ts b/src/app/shared/utils/date.ts index 7a0da2f6e..dad9094ca 100644 --- a/src/app/shared/utils/date.ts +++ b/src/app/shared/utils/date.ts @@ -11,7 +11,7 @@ export function parseISOLocalDateTime(dateString: string): Date { dateArray[2], dateArray[3], dateArray[4], - dateArray[5] + dateArray[5], ); } @@ -34,7 +34,7 @@ export function formatISOLocalDateTime(date: Date): string { return ( formatISOLocalDate(date) + `T${zeroPadding(date.getHours())}:${zeroPadding( - date.getMinutes() + date.getMinutes(), )}:${zeroPadding(date.getSeconds())}` ); } @@ -46,7 +46,7 @@ export function formatISOLocalDateTime(date: Date): string { */ export function formatISOLocalDate(date: Date): string { return `${date.getFullYear()}-${zeroPadding( - date.getMonth() + 1 + date.getMonth() + 1, )}-${zeroPadding(date.getDate())}`; } diff --git a/src/app/shared/utils/decode.spec.ts b/src/app/shared/utils/decode.spec.ts index 1e8dc47c5..328bf835f 100644 --- a/src/app/shared/utils/decode.spec.ts +++ b/src/app/shared/utils/decode.spec.ts @@ -36,8 +36,8 @@ describe('decode utils', () => { expect(success).not.toHaveBeenCalled(); expect(error).toHaveBeenCalledWith( new DecodeError( - 'Invalid value 123 supplied to : { foo: string }/foo: string' - ) + 'Invalid value 123 supplied to : { foo: string }/foo: string', + ), ); }); }); @@ -58,8 +58,8 @@ describe('decode utils', () => { expect(success).not.toHaveBeenCalled(); expect(error).toHaveBeenCalledWith( new DecodeError( - 'Invalid value undefined supplied to : Array<{ foo: string }>/1: { foo: string }/foo: string' - ) + 'Invalid value undefined supplied to : Array<{ foo: string }>/1: { foo: string }/foo: string', + ), ); }); }); diff --git a/src/app/shared/utils/decode.ts b/src/app/shared/utils/decode.ts index 4695f7a2f..d2a69bfb6 100644 --- a/src/app/shared/utils/decode.ts +++ b/src/app/shared/utils/decode.ts @@ -22,7 +22,7 @@ export class DecodeError extends Error { * this.http.get(...).pipe(switchMap(decode(Foo))).subscribe(...) */ export function decode( - codec: C + codec: C, ): (json: unknown) => Observable> { return (json) => { return pipe( @@ -30,10 +30,10 @@ export function decode( fold( (error) => throwError( - () => new DecodeError(PathReporter.report(left(error)).join('\n')) + () => new DecodeError(PathReporter.report(left(error)).join('\n')), ), - (data) => of(data) - ) + (data) => of(data), + ), ); }; } @@ -43,7 +43,7 @@ export function decode( * but without having to import io-ts: `decodeArray(X)`. */ export function decodeArray( - codec: C + codec: C, ): (json: unknown) => Observable>> { return decode(t.array(codec)); } diff --git a/src/app/shared/utils/drop-down-items.ts b/src/app/shared/utils/drop-down-items.ts index ee948c1ae..44cb771cf 100644 --- a/src/app/shared/utils/drop-down-items.ts +++ b/src/app/shared/utils/drop-down-items.ts @@ -4,13 +4,13 @@ import { map } from 'rxjs/operators'; export function findDropDownItem$( items$: Observable>, - key: number + key: number, ): Observable> { return items$.pipe(map((items) => items.find((i) => i.Key === key) || null)); } export function sortDropDownItemsByValue( - items: ReadonlyArray + items: ReadonlyArray, ): ReadonlyArray { return items.slice().sort((a, b) => a.Value.localeCompare(b.Value)); } diff --git a/src/app/shared/utils/filter.spec.ts b/src/app/shared/utils/filter.spec.ts index 78ed4caaa..387f2cbda 100644 --- a/src/app/shared/utils/filter.spec.ts +++ b/src/app/shared/utils/filter.spec.ts @@ -86,14 +86,14 @@ describe('filter utils', () => { not((arg) => { expect(arg).toBe(123); return true; - })(123) + })(123), ).toBe(false); expect( not((arg) => { expect(arg).toBe(123); return false; - })(123) + })(123), ).toBe(true); }); }); diff --git a/src/app/shared/utils/gradings.ts b/src/app/shared/utils/gradings.ts index ccecacd2c..40b6b9ef5 100644 --- a/src/app/shared/utils/gradings.ts +++ b/src/app/shared/utils/gradings.ts @@ -14,7 +14,7 @@ import { Grade, GradingScale } from '../models/grading-scale.model'; export function evaluate( grading: Option, finalGrade: Option, - gradingScale: Option + gradingScale: Option, ): Maybe { if (finalGrade) return finalGrade.Grade; return findInScale(grading, gradingScale) || grading?.GradeValue; @@ -22,9 +22,9 @@ export function evaluate( function findInScale( grading: Option, - gradingScale: Option + gradingScale: Option, ): Maybe { return gradingScale?.Grades.find( - (grade: Grade) => grade.Id === grading?.GradeId + (grade: Grade) => grade.Id === grading?.GradeId, )?.Designation; } diff --git a/src/app/shared/utils/lesson-presences.spec.ts b/src/app/shared/utils/lesson-presences.spec.ts index 20b531950..1b6ee1ca2 100644 --- a/src/app/shared/utils/lesson-presences.spec.ts +++ b/src/app/shared/utils/lesson-presences.spec.ts @@ -85,11 +85,11 @@ describe('lesson presences utils', () => { 1, new Date(2021, 3, 22, 9, 0), new Date(2021, 3, 22, 9, 45), - 'Deutsch-S1' + 'Deutsch-S1', ); expect(toDesignationDateTimeTypeString(presence)).toBe( - 'Deutsch-S1, 22.04.2021, 09:00-09:45' + 'Deutsch-S1, 22.04.2021, 09:00-09:45', ); }); }); diff --git a/src/app/shared/utils/lesson-presences.ts b/src/app/shared/utils/lesson-presences.ts index cf9e41b42..659ef04c4 100644 --- a/src/app/shared/utils/lesson-presences.ts +++ b/src/app/shared/utils/lesson-presences.ts @@ -2,18 +2,21 @@ import { LessonPresence } from '../models/lesson-presence.model'; import { format } from 'date-fns'; export function getIdsGroupedByPerson( - lessonPresences: ReadonlyArray + lessonPresences: ReadonlyArray, ): ReadonlyArray<{ personIds: ReadonlyArray; lessonIds: ReadonlyArray; }> { - const grouped = lessonPresences.reduce((acc, p) => { - if (!acc[p.StudentRef.Id]) { - acc[p.StudentRef.Id] = []; - } - acc[p.StudentRef.Id].push(p.LessonRef.Id); - return acc; - }, {} as Dict); + const grouped = lessonPresences.reduce( + (acc, p) => { + if (!acc[p.StudentRef.Id]) { + acc[p.StudentRef.Id] = []; + } + acc[p.StudentRef.Id].push(p.LessonRef.Id); + return acc; + }, + {} as Dict, + ); return Object.keys(grouped).map((personId) => { return { personIds: [Number(personId)], @@ -23,7 +26,7 @@ export function getIdsGroupedByPerson( } export function getIdsGroupedByPersonAndPresenceType( - lessonPresences: ReadonlyArray + lessonPresences: ReadonlyArray, ): ReadonlyArray<{ personId: number; presenceTypeId: Option; @@ -57,23 +60,26 @@ export function getIdsGroupedByPersonAndPresenceType( personId: number; presenceTypeId: Option; lessonIds: ReadonlyArray; - }> + }>, ); } export function getIdsGroupedByLesson( - lessonPresences: ReadonlyArray + lessonPresences: ReadonlyArray, ): ReadonlyArray<{ lessonIds: ReadonlyArray; personIds: ReadonlyArray; }> { - const grouped = lessonPresences.reduce((acc, p) => { - if (!acc[p.LessonRef.Id]) { - acc[p.LessonRef.Id] = []; - } - acc[p.LessonRef.Id].push(p.StudentRef.Id); - return acc; - }, {} as Dict); + const grouped = lessonPresences.reduce( + (acc, p) => { + if (!acc[p.LessonRef.Id]) { + acc[p.LessonRef.Id] = []; + } + acc[p.LessonRef.Id].push(p.StudentRef.Id); + return acc; + }, + {} as Dict, + ); return Object.keys(grouped).map((lessonId) => { return { lessonIds: [Number(lessonId)], @@ -83,23 +89,23 @@ export function getIdsGroupedByLesson( } export function sortLessonPresencesByDate( - lessonPresences: ReadonlyArray + lessonPresences: ReadonlyArray, ): ReadonlyArray { return lessonPresences .slice() .sort( - (a, b) => a.LessonDateTimeFrom.getTime() - b.LessonDateTimeFrom.getTime() + (a, b) => a.LessonDateTimeFrom.getTime() - b.LessonDateTimeFrom.getTime(), ); } export function toDesignationDateTimeTypeString( - lessonPresence: LessonPresence + lessonPresence: LessonPresence, ): string { return `${lessonPresence.EventDesignation}, ${format( lessonPresence.LessonDateTimeFrom, - 'dd.MM.yyyy' + 'dd.MM.yyyy', )}, ${format(lessonPresence.LessonDateTimeFrom, 'HH:mm')}-${format( lessonPresence.LessonDateTimeTo, - 'HH:mm' - )}`; + 'HH:mm', + )}`; } diff --git a/src/app/shared/utils/pagination.ts b/src/app/shared/utils/pagination.ts index 1e7f19056..3163f17b1 100644 --- a/src/app/shared/utils/pagination.ts +++ b/src/app/shared/utils/pagination.ts @@ -31,9 +31,9 @@ export interface Paginated { * } */ export function decodePaginatedResponse( - codec: C + codec: C, ): ( - source: Observable> + source: Observable>, ) => Observable>>> { return (source) => { return source.pipe( @@ -41,9 +41,9 @@ export function decodePaginatedResponse( const offset = Number(response.headers.get('X-Pagination-Offset')); const total = Number(response.headers.get('X-Pagination-Total')); return decodeArray(codec)(response.body).pipe( - map((entries) => ({ offset, total, entries })) + map((entries) => ({ offset, total, entries })), ); - }) + }), ); }; } @@ -51,7 +51,7 @@ export function decodePaginatedResponse( export function paginatedParams( offset: number, limit: number, - params = new HttpParams() + params = new HttpParams(), ): HttpParams { return params.set('offset', String(offset)).set('limit', String(limit)); } diff --git a/src/app/shared/utils/presence-control-entries.ts b/src/app/shared/utils/presence-control-entries.ts index fa4ca2d86..d08e72076 100644 --- a/src/app/shared/utils/presence-control-entries.ts +++ b/src/app/shared/utils/presence-control-entries.ts @@ -7,7 +7,7 @@ import { GroupOptions } from '../../presence-control/components/presence-control export function buildPresenceControlEntries( lessonPresences: ReadonlyArray, presenceTypes: ReadonlyArray, - confirmationStates: ReadonlyArray + confirmationStates: ReadonlyArray, ): ReadonlyArray { return lessonPresences.map((lessonPresence) => { let presenceType = null; @@ -18,14 +18,14 @@ export function buildPresenceControlEntries( let confirmationState: DropDownItem | undefined; if (lessonPresence.ConfirmationStateId) { confirmationState = confirmationStates.find( - (s) => s.Key === lessonPresence.ConfirmationStateId + (s) => s.Key === lessonPresence.ConfirmationStateId, ); } return new PresenceControlEntry( lessonPresence, presenceType, null, - confirmationState + confirmationState, ); }); } @@ -33,11 +33,11 @@ export function buildPresenceControlEntries( export function filterByGroup( group: GroupOptions['id'], entries: ReadonlyArray, - personIds: ReadonlyArray + personIds: ReadonlyArray, ): ReadonlyArray { if (group) { return entries.filter((e) => - personIds.find((id) => id === e.lessonPresence.StudentRef.Id) + personIds.find((id) => id === e.lessonPresence.StudentRef.Id), ); } diff --git a/src/app/shared/utils/search.ts b/src/app/shared/utils/search.ts index 97ab77ed1..685b4c186 100644 --- a/src/app/shared/utils/search.ts +++ b/src/app/shared/utils/search.ts @@ -9,7 +9,7 @@ export interface Searchable { export function searchEntries( entries: ReadonlyArray, - term: string + term: string, ): ReadonlyArray { if (!term) { return entries; diff --git a/src/app/shared/utils/url.spec.ts b/src/app/shared/utils/url.spec.ts index a48a56dd2..c3bcaa446 100644 --- a/src/app/shared/utils/url.spec.ts +++ b/src/app/shared/utils/url.spec.ts @@ -9,7 +9,7 @@ describe('url utilities', () => { baz: '123', empty_value: '', no_value: undefined, - } + }, ); }); }); @@ -22,7 +22,7 @@ describe('url utilities', () => { baz: '123', empty_value: '', no_value: undefined, - }) + }), ).toBe('foo=bar&baz=123&empty_value=&no_value'); }); }); @@ -33,12 +33,12 @@ describe('url utilities', () => { }); it('should get the first element of url with multiple segments', () => { expect(getFirstSegment('/presence-control/student/3')).toBe( - 'presence-control' + 'presence-control', ); }); it('should get the first element of url with params', () => { expect(getFirstSegment('/presence-control?date=2020-02-20')).toBe( - 'presence-control' + 'presence-control', ); }); it('should get the first element of root url', () => { diff --git a/src/app/shared/utils/user-settings.ts b/src/app/shared/utils/user-settings.ts index 6993352f8..5e7b385d8 100644 --- a/src/app/shared/utils/user-settings.ts +++ b/src/app/shared/utils/user-settings.ts @@ -4,7 +4,7 @@ import { GroupOptions } from '../../presence-control/components/presence-control export function updateGroupViewSettings( group: GroupOptions['id'], eventIds: ReadonlyArray, - existingSettings: ReadonlyArray + existingSettings: ReadonlyArray, ): ReadonlyArray { const newSettings: ReadonlyArray = eventIds.map((eventId) => { @@ -12,10 +12,10 @@ export function updateGroupViewSettings( }); const updatedSettings = existingSettings.map( - (es) => newSettings.find((ns) => ns.eventId === es.eventId) || es + (es) => newSettings.find((ns) => ns.eventId === es.eventId) || es, ); return [...new Set([...updatedSettings, ...newSettings])].filter( - (settings) => settings.group !== null + (settings) => settings.group !== null, ); } diff --git a/src/index.html b/src/index.html index 836bb019e..20ab80857 100644 --- a/src/index.html +++ b/src/index.html @@ -1,4 +1,4 @@ - + diff --git a/src/karma.conf.js b/src/karma.conf.js index bcc2d1b50..aec4aa663 100644 --- a/src/karma.conf.js +++ b/src/karma.conf.js @@ -20,7 +20,7 @@ module.exports = function (config) { coverageIstanbulReporter: { dir: require('path').join( __dirname, - '../coverage/webapp-schulverwaltung' + '../coverage/webapp-schulverwaltung', ), reports: ['html', 'lcovonly', 'text-summary'], fixWebpackSourcePaths: true, diff --git a/src/specs/expectations.ts b/src/specs/expectations.ts index 8bd9788a2..afd08c22f 100644 --- a/src/specs/expectations.ts +++ b/src/specs/expectations.ts @@ -4,7 +4,7 @@ import { byTestId } from './utils'; export function expectText( debugElement: DebugElement, testId: string, - expected: string + expected: string, ) { assertDebugElement(debugElement); @@ -12,7 +12,7 @@ export function expectText( if (!element) { console.error(debugElement.nativeElement.innerHTML); throw new Error( - `unable to locate element with attribute [data-testid]=${testId} - see console to see an unformatted output of your current html` + `unable to locate element with attribute [data-testid]=${testId} - see console to see an unformatted output of your current html`, ); } @@ -21,7 +21,7 @@ export function expectText( export function expectNotInTheDocument( debugElement: DebugElement, - testId: string + testId: string, ) { assertDebugElement(debugElement); expect(debugElement.query(byTestId(testId))).toBeNull(); @@ -29,7 +29,7 @@ export function expectNotInTheDocument( export function expectElementPresent( debugElement: DebugElement, - testId: string + testId: string, ) { assertDebugElement(debugElement); expect(debugElement.query(byTestId(testId))).toBeTruthy(); diff --git a/src/test.ts b/src/test.ts index 1886cdad9..51820cf72 100644 --- a/src/test.ts +++ b/src/test.ts @@ -13,5 +13,5 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting(), { teardown: { destroyAfterEach: false }, - } + }, );