diff --git a/biscuit/apps/alsijil/templates/alsijil/print/full_register.html b/biscuit/apps/alsijil/templates/alsijil/print/full_register.html index 6170527d663f0804d93e86f2baa4acfb0667b4b8..1227797c39dd9c4d81a039df55db0e36ba7e9d40 100644 --- a/biscuit/apps/alsijil/templates/alsijil/print/full_register.html +++ b/biscuit/apps/alsijil/templates/alsijil/print/full_register.html @@ -67,17 +67,23 @@ <th>{% trans 'First name' %}</th> <th>{% trans 'Sex' %}</th> <th>{% trans 'Date of birth' %}</th> + <th>{% trans 'Absences' %}</th> + <th>{% trans 'Unexcused' %}</th> + <th>{% trans 'Tard.' %}</th> </tr> </thead> <tbody> - {% for person in group.members.all %} + {% for person in persons %} <tr> <td>{{ forloop.counter }}</td> <td>{{ person.last_name }}</td> <td>{{ person.first_name }}</td> <td>{{ person.get_sex_display }}</td> <td>{{ person.date_of_birth }}</td> + <td>{{ person.absences}}</td> + <td>{{ person.unexcused }}</td> + <td>{{ person.tardiness }}</td> </tr> {% endfor %} </tbody> diff --git a/biscuit/apps/alsijil/views.py b/biscuit/apps/alsijil/views.py index a0f1b1b742b6d6b441ea2e62d1df26709b10879e..f31b14af162cabdeebdf7452496a8ec4f592a19b 100644 --- a/biscuit/apps/alsijil/views.py +++ b/biscuit/apps/alsijil/views.py @@ -182,6 +182,18 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse: periods_by_day.setdefault(day, []).append((lesson_period, documentations, notes, substitution)) + persons = group.members.annotate( + absences=Count('personal_notes__absent', filter=Q( + personal_notes__absent=True + )), + unexcused=Count('personal_notes__absent', filter=Q( + personal_notes__absent=True, + personal_notes__excused=False + )), + tardiness=Sum('personal_notes__late') + ) + + context['persons'] = persons context['group'] = group context['weeks'] = weeks context['periods_by_day'] = periods_by_day