Skip to content
Snippets Groups Projects
Commit d98f5e9f authored by Julian's avatar Julian
Browse files

Show student names grouped by absence reason

parent bffed362
No related branches found
No related tags found
1 merge request!360Resolve "Add absence management to course book student dialog"
...@@ -26,6 +26,7 @@ mutation touchDocumentation($documentationId: ID!) { ...@@ -26,6 +26,7 @@ mutation touchDocumentation($documentationId: ID!) {
id id
person { person {
id id
firstName
fullName fullName
} }
absenceReason { absenceReason {
......
...@@ -70,6 +70,7 @@ query documentationsForCoursebook( ...@@ -70,6 +70,7 @@ query documentationsForCoursebook(
id id
person { person {
id id
firstName
fullName fullName
} }
absenceReason { absenceReason {
......
...@@ -10,12 +10,29 @@ import AbsenceReasonChip from "aleksis.apps.kolego/components/AbsenceReasonChip. ...@@ -10,12 +10,29 @@ import AbsenceReasonChip from "aleksis.apps.kolego/components/AbsenceReasonChip.
{{ $t("alsijil.coursebook.present_number", { present, total }) }} {{ $t("alsijil.coursebook.present_number", { present, total }) }}
</v-chip> </v-chip>
<absence-reason-chip <absence-reason-chip
v-for="participation in absences" v-for="[reasonId, participations] in Object.entries(absences)"
:key="'absence-' + participation.id" :key="'reason-' + reasonId"
:absence-reason="participation.absenceReason" :absence-reason="participations[0].absenceReason"
dense dense
> >
<template #prepend> {{ participation.person.fullName }}: </template> <template #append>
<span
>:
<span>
{{
participations
.slice(0, 5)
.map((participation) => participation.person.firstName)
.join(", ")
}}
</span>
<span v-if="participations.length > 5">
<!-- eslint-disable @intlify/vue-i18n/no-raw-text -->
+{{ participations.length - 5 }}
<!-- eslint-enable @intlify/vue-i18n/no-raw-text -->
</span>
</span>
</template>
</absence-reason-chip> </absence-reason-chip>
<manage-students-trigger v-bind="documentationPartProps" /> <manage-students-trigger v-bind="documentationPartProps" />
...@@ -41,8 +58,11 @@ export default { ...@@ -41,8 +58,11 @@ export default {
}, },
absences() { absences() {
// Get all course attendants who have an absence reason // Get all course attendants who have an absence reason
return this.documentation.participations.filter( return Object.groupBy(
(p) => p.absenceReason !== null, this.documentation.participations.filter(
(p) => p.absenceReason !== null,
),
({ absenceReason }) => absenceReason.id,
); );
}, },
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment