Skip to content
Snippets Groups Projects
Verified Commit 1c395b53 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Finalise lesson docuemntations in report printing, advances #26.

parent 6285a317
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,11 @@ body.legal.landscape .sheet { width: 357mm; height: 215mm }
body {
font-family: Arial, Helvetica, san-serif;
font-size: 11pt;
font-size: 10pt;
}
section.sheet.smallprint {
font-size: 8pt;
}
#titlepage h1 {
......@@ -91,3 +95,19 @@ th, td {
tr:nth-child(even) {
background-color: #f2f2f2;
}
tr.lesson-substituted {
background-color: #ffc107;
}
tr.lesson-cancelled {
background-color: #dc3545;
}
tr.lesson-cancelled td {
text-decoration: line-through:
}
tr.lesson-substituted td.lesson-subj {
text-decoration: line-through;
}
......@@ -80,12 +80,56 @@
</section>
{% for week in weeks %}
<section class="sheet padding-10mm">
<h2>{% trans 'Lesson documentation for week' %} {{ week }}</h2>
<section class="sheet padding-10mm smallprint">
<h2>{% trans 'Lesson documentation for calendar week' %} {{ week.week }}</h2>
{% for day in week %}
<h3>{{ day }}</h3>
{{ periods_by_day|get_dict:day }}
{% if periods_by_day|get_dict:day %}
<h3>{{ day }}</h3>
<table>
<thead>
<tr>
<th>{% trans 'Pe.' %}</th>
<th>{% trans 'Subj.' %}</th>
<th>{% trans 'Subs.' %}</th>
<th>{% trans 'Lesson topic' %}</th>
<th>{% trans 'Homework' %}</th>
<th>{% trans 'Te.' %}</th>
</tr>
</thead>
<tbody>
{% for period, documentations, substitution in periods_by_day|get_dict:day %}
<tr class="
{% if substitution %}
{% if substitution.cancelled %}
lesson-cancelled
{% else %}
lesson-substituted
{% endif %}
{% endif %}
">
<td class="lesson-pe">{{ period.period.period }}</td>
<td class="lesson-subj">{{ period.lesson.subject.abbrev }}</td>
<td class="lesson-subs">{{ substitution.subject.abbrev }}</td>
<td class="lesson-topic">
{% if substitution.cancelled %}
{% trans 'Lesson cancelled' %}
{% else %}
{{ documentations.0.topic }}
{% endif %}
</td>
<td class="lesson-homework">{{ documentations.0.homework }}</td>
<td class="lesson-te">
{% if documentations.0.topic %}
{{ substitution.teachers.first.short_name|default:period.lesson.teachers.first.short_name }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
</section>
{% endfor %}
......
......@@ -189,7 +189,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
).select_related(
'lesson', 'lesson__subject', 'period', 'room'
).prefetch_related(
'lesson__groups', 'lesson__teachers', 'substitutions'
'lesson__groups', 'lesson__teachers', 'substitutions', 'documentations'
).filter(
Q(lesson__groups=group) | Q(lesson__groups__parent_groups=group)
).distinct()
......@@ -221,8 +221,12 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
for lesson_period in lesson_periods:
for week in weeks:
day = week[lesson_period.period.weekday - 1]
if lesson_period.lesson.date_start <= day and lesson_period.lesson.date_end >= day:
periods_by_day.setdefault(day, []).append(lesson_period)
documentations = list(filter(lambda d: d.week == week.week, lesson_period.documentations.all()))
substitution = lesson_period.get_substitution(week.week)
periods_by_day.setdefault(day, []).append((lesson_period, documentations, substitution))
context['group'] = group
context['weeks'] = weeks
......
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