diff --git a/src/app/my-absences/components/my-absences-show/my-absences-show.component.html b/src/app/my-absences/components/my-absences-show/my-absences-show.component.html index 558dcfcd3..2e805bbbf 100644 --- a/src/app/my-absences/components/my-absences-show/my-absences-show.component.html +++ b/src/app/my-absences/components/my-absences-show/my-absences-show.component.html @@ -12,6 +12,25 @@ + + + + {{ 'shared.profile.checkable-absences' | translate }} + ({{ data.absenceCounts.checkableAbsences }}) + + + + + + + { return combineLatest([ + this.getCount(this.checkableAbsences$), this.getCount(this.openAbsences$), this.getCount(this.excusedAbsences$), this.getCount(this.unexcusedAbsences$), this.getCount(this.incidents$), ]).pipe( - map(([openAbsences, excusedAbsences, unexcusedAbsences, incidents]) => ({ - openAbsences, - excusedAbsences, - unexcusedAbsences, - incidents, - halfDays: null, - })) + map( + ([ + checkableAbsences, + openAbsences, + excusedAbsences, + unexcusedAbsences, + incidents, + ]) => ({ + checkableAbsences, + openAbsences, + excusedAbsences, + unexcusedAbsences, + incidents, + halfDays: null, + }) + ) ); } diff --git a/src/app/shared/components/student-profile/student-profile.component.html b/src/app/shared/components/student-profile/student-profile.component.html index efbb0ba36..bf117c286 100644 --- a/src/app/shared/components/student-profile/student-profile.component.html +++ b/src/app/shared/components/student-profile/student-profile.component.html @@ -83,6 +83,26 @@ + + + + {{ 'shared.profile.checkable-absences' | translate }} + ({{ data.absenceCounts.checkableAbsences }}) + + + + + + + (1); + checkableAbsences$ = this.getAbsences(this.loadCheckableAbsences.bind(this)); openAbsences$ = this.getAbsences(this.loadOpenAbsences.bind(this)); excusedAbsences$ = this.getAbsences(this.loadExcusedAbsences.bind(this)); unexcusedAbsences$ = this.getAbsences(this.loadUnexcusedAbsences.bind(this)); @@ -64,10 +65,14 @@ export class StudentProfileAbsencesService { return combineLatest([ this.loadStatistics(studentId).pipe(startWith(null)), this.openAbsences$.pipe(map((absences) => absences?.length ?? null)), + this.checkableAbsences$.pipe( + map((absences) => absences?.length ?? null) + ), ]); }), - map(([statistics, openAbsencesCount]) => ({ + map(([statistics, openAbsencesCount, checkableAbsencesCount]) => ({ openAbsences: openAbsencesCount, + checkableAbsences: checkableAbsencesCount, excusedAbsences: statistics?.TotalAbsencesValidExcuse ?? null, unexcusedAbsences: statistics?.TotalAbsencesWithoutExcuse ?? null, incidents: statistics?.TotalIncidents ?? null, @@ -107,6 +112,17 @@ export class StudentProfileAbsencesService { ); } + private loadCheckableAbsences( + studentId: number + ): Observable> { + return this.lessonPresencesService.getList({ + params: { + ...this.getBaseParams(studentId), + 'filter.ConfirmationStateId': `=${this.settings.checkableAbsenceStateId}`, + }, + }); + } + private loadExcusedAbsences( studentId: number ): Observable> { diff --git a/src/assets/locales/de-CH.json b/src/assets/locales/de-CH.json index 801728577..415762229 100644 --- a/src/assets/locales/de-CH.json +++ b/src/assets/locales/de-CH.json @@ -241,6 +241,7 @@ "apprenticeship-company": "Lehrbetrieb", "apprenticeship-period": "Lehrzeit", "job-trainer": "Berufsbildner/in", + "checkable-absences": "Gemeldete Absenzen", "open-absences": "Offene Absenzen", "excused-absences": "Entschuldigte Absenzen", "unexcused-absences": "Unentschuldigte Absenzen",