Skip to content
Snippets Groups Projects
Verified Commit 2197e680 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

[Full register printout] Show statistics on extra marks and personal notes with extra marks

parent 5a66f5fb
No related branches found
No related tags found
1 merge request!68Resolve "Add option to configure extra marks for personal notes"
...@@ -77,6 +77,9 @@ ...@@ -77,6 +77,9 @@
<th>{% trans 'Absences' %}</th> <th>{% trans 'Absences' %}</th>
<th>{% trans 'Unexcused' %}</th> <th>{% trans 'Unexcused' %}</th>
<th>{% trans 'Tard.' %}</th> <th>{% trans 'Tard.' %}</th>
{% for extra_mark in extra_marks %}
<th>{{ extra_mark.short_name }}</th>
{% endfor %}
</tr> </tr>
</thead> </thead>
...@@ -91,6 +94,9 @@ ...@@ -91,6 +94,9 @@
<td>{{ person.absences_count }}</td> <td>{{ person.absences_count }}</td>
<td>{{ person.unexcused }}</td> <td>{{ person.unexcused }}</td>
<td>{{ person.tardiness }}'</td> <td>{{ person.tardiness }}'</td>
{% for extra_mark in extra_marks %}
<td>{{ person|get_dict:extra_mark.count_label }}</td>
{% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
...@@ -243,6 +249,18 @@ ...@@ -243,6 +249,18 @@
</tbody> </tbody>
</table> </table>
{% if extra_marks %}
<h5>{% trans 'Extra marks' %}</h5>
<table>
{% for extra_mark in extra_marks %}
<tr>
<th>{{ extra_mark.name }}</th>
<td>{{ person|get_dict:extra_mark.count_label }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
<h5>{% trans 'Relevant personal notes' %}</h5> <h5>{% trans 'Relevant personal notes' %}</h5>
<table class="small-print"> <table class="small-print">
<thead> <thead>
...@@ -253,13 +271,13 @@ ...@@ -253,13 +271,13 @@
<th>{% trans 'Te.' %}</th> <th>{% trans 'Te.' %}</th>
<th>{% trans 'Absent' %}</th> <th>{% trans 'Absent' %}</th>
<th>{% trans 'Tard.' %}</th> <th>{% trans 'Tard.' %}</th>
<th>{% trans 'Remarks' %}</th> <th colspan="2">{% trans 'Remarks' %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for note in person.personal_notes.all %} {% for note in person.personal_notes.all %}
{% if note.absent or note.late or note.remarks %} {% if note.absent or note.late or note.remarks or note.extra_marks.all %}
{% period_to_date note.week note.lesson_period.period as note_date %} {% period_to_date note.week note.lesson_period.period as note_date %}
<tr> <tr>
<td>{{ note_date }}</td> <td>{{ note_date }}</td>
...@@ -279,6 +297,11 @@ ...@@ -279,6 +297,11 @@
{{ note.late }}' {{ note.late }}'
{% endif %} {% endif %}
</td> </td>
<td>
{% for extra_mark in note.extra_marks.all %}
{{ extra_mark.short_name }}{% if not forloop.last %},{% endif %}
{% endfor %}
</td>
<td>{{ note.remarks }}</td> <td>{{ note.remarks }}</td>
</tr> </tr>
{% endif %} {% endif %}
...@@ -363,6 +386,12 @@ ...@@ -363,6 +386,12 @@
{% endif %} {% endif %}
</span> </span>
{% endif %} {% endif %}
{% for extra_mark in note.extra_marks.all %}
<span>
{{ note.person.last_name }}, {{ note.person.first_name|slice:"0:1" }}.
({{ extra_mark.short_name }})
</span>
{% endfor %}
{% endfor %} {% endfor %}
</td> </td>
<td class="lesson-te"> <td class="lesson-te">
......
...@@ -332,6 +332,15 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse: ...@@ -332,6 +332,15 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
tardiness=Sum("personal_notes__late"), tardiness=Sum("personal_notes__late"),
) )
for extra_mark in ExtraMark.objects.all():
persons = persons.annotate(
**{
extra_mark.count_label: Count(
"personal_notes", filter=Q(personal_notes__extra_marks=extra_mark,),
)
}
)
# FIXME Move to manager # FIXME Move to manager
personal_note_filters = PersonalNoteFilter.objects.all() personal_note_filters = PersonalNoteFilter.objects.all()
for personal_note_filter in personal_note_filters: for personal_note_filter in personal_note_filters:
...@@ -347,6 +356,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse: ...@@ -347,6 +356,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
} }
) )
context["extra_marks"] = ExtraMark.objects.all()
context["persons"] = persons context["persons"] = persons
context["personal_note_filters"] = personal_note_filters context["personal_note_filters"] = personal_note_filters
context["group"] = group context["group"] = group
......
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