From 40967ac94f86967b7c86afc7e911313b026b41e2 Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Fri, 24 Jan 2025 18:25:23 +0100
Subject: [PATCH] Add indicator for not counted absences

---
 .../coursebook/statistics/StatisticsForPersonPage.vue     | 8 ++++++++
 .../components/coursebook/statistics/statistics.graphql   | 1 +
 aleksis/apps/alsijil/frontend/messages/de.json            | 3 ++-
 aleksis/apps/alsijil/frontend/messages/en.json            | 3 ++-
 aleksis/apps/alsijil/schema/documentation.py              | 6 ++++++
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue
index dc8ae7867..c9c8bcd3c 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/StatisticsForPersonPage.vue
@@ -179,6 +179,14 @@
                         <v-list-item-action
                           class="flex-row full-width justify-md-end ma-0 align-center fill-height"
                         >
+                          <v-chip
+                            color="warning"
+                            class="mx-1"
+                            v-if="!item.relatedDocumentation.amended"
+                            >{{
+                              $t("alsijil.coursebook.statistics.not_counted")
+                            }}</v-chip
+                          >
                           <!-- chips: absences & extraMarks -->
                           <absence-reason-chip
                             v-if="item.absenceReason"
diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql
index 1cffdc717..a83e3fa59 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/statistics/statistics.graphql
@@ -64,6 +64,7 @@ query participationsOfPerson($person: ID!) {
         colourFg
         colourBg
       }
+      amended
     }
     canEdit
     canDelete
diff --git a/aleksis/apps/alsijil/frontend/messages/de.json b/aleksis/apps/alsijil/frontend/messages/de.json
index 4d134acfe..b1650ed2b 100644
--- a/aleksis/apps/alsijil/frontend/messages/de.json
+++ b/aleksis/apps/alsijil/frontend/messages/de.json
@@ -82,7 +82,8 @@
           "title": "Kursbuch · Statistiken · {fullName}"
         },
         "person_view_details": "Details",
-        "title_plural": "Statistiken"
+        "title_plural": "Statistiken",
+        "not_counted": "nicht gezählt"
       },
       "status": {
         "available": "Kursbucheintrag vorhanden",
diff --git a/aleksis/apps/alsijil/frontend/messages/en.json b/aleksis/apps/alsijil/frontend/messages/en.json
index a40f8d547..99ce86919 100644
--- a/aleksis/apps/alsijil/frontend/messages/en.json
+++ b/aleksis/apps/alsijil/frontend/messages/en.json
@@ -85,7 +85,8 @@
           "summary": "Summary"
         },
         "person_view_details": "Details",
-        "title_plural": "Statistics"
+        "title_plural": "Statistics",
+        "not_counted": "not counted"
       },
       "notes": {
         "show_list": "List of participants",
diff --git a/aleksis/apps/alsijil/schema/documentation.py b/aleksis/apps/alsijil/schema/documentation.py
index ad88b2de3..9548581a6 100644
--- a/aleksis/apps/alsijil/schema/documentation.py
+++ b/aleksis/apps/alsijil/schema/documentation.py
@@ -48,6 +48,7 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
 
     course = graphene.Field(CourseType, required=False)
     amends = graphene.Field(lambda: LessonEventType, required=False)
+    amended = graphene.Boolean(required=False)
     subject = graphene.Field(SubjectType, required=False)
     participations = graphene.List(ParticipationStatusType, required=False)
 
@@ -66,6 +67,11 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
             return root._amends_prefetched
         return root.amends
 
+    @staticmethod
+    @bypass_get_queryset
+    def resolve_amended(root: Documentation, info, **kwargs):
+        return root.amends_id is not None
+
     @staticmethod
     @bypass_get_queryset
     def resolve_teachers(root: Documentation, info, **kwargs):
-- 
GitLab