Skip to content
Snippets Groups Projects
Verified Commit c929a26e authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add sum of absences and tardiness to printout.

parent 4eac6522
No related branches found
No related tags found
1 merge request!20Add sum of absences and tardiness to printout.
......@@ -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>
......
......@@ -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
......
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