From 34e226557ad7528071f834d29edeadf705fb32ab Mon Sep 17 00:00:00 2001
From: Michael Bauer <michael-bauer@posteo.de>
Date: Wed, 30 Oct 2024 13:02:07 +0100
Subject: [PATCH] Adapt the coursebook-template's absences to the new datamodel

---
 .../alsijil/partials/register_coursebook.html | 33 +++++--------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html b/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html
index 9dccecfd6..f0dff0573 100644
--- a/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html
+++ b/aleksis/apps/alsijil/templates/alsijil/partials/register_coursebook.html
@@ -53,34 +53,19 @@
           <td class="lesson-homework">{{ doc.homework }}</td>
           <td class="lesson-notes">
             {{ documentation.group_note }}
-            {% for note in notes %}
-              {% if note.absent %}
+            {% for participation in doc.notable_participations %}
+              {% if participation.absence_reason %}
                 <span class="lesson-note-absent">
-                  {{ note.person.last_name }}, {{ note.person.first_name|slice:"0:1" }}.
-                  {% if note.excused %}
-                    <span class="lesson-note-excused">
-                      {% if note.excuse_type %}
-                        ({{ note.excuse_type.short_name }})
-                      {% else %}
-                        ({% trans 'e' %})
-                      {% endif %}
-                    </span>
-                  {% endif %}
+                  {{ participation.person.short_name }}
+                  <span class="lesson-note-excused">
+                    ({{ participation.absence_reason.short_name }})
+                  </span>
                 </span>
               {% endif %}
-              {% if note.tardiness %}
+              {% if participation.tardiness %}
                 <span class="lesson-note-late">
-                  {{ note.person.last_name }}, {{ note.person.first_name|slice:"0:1" }}.
-                  ({{ note.tardiness }}′)
-                  {% if note.excused %}
-                    <span class="lesson-note-excused">
-                      {% if note.excuse_type %}
-                        ({{ note.excuse_type.short_name }})
-                      {% else %}
-                        ({% trans 'e' %})
-                      {% endif %}
-                    </span>
-                  {% endif %}
+                  {{ participation.person.short_name }}
+                  ({{ participation.tardiness }}′)
                 </span>
               {% endif %}
               {% for extra_mark in note.extra_marks.all %}
-- 
GitLab