Skip to content
Snippets Groups Projects

Performance optimizations

Merged Jonathan Weth requested to merge feature/performance-optimizations into master
Compare and
9 files
+ 334
205
Compare changes
  • Side-by-side
  • Inline
Files
9
@@ -12,7 +12,7 @@
{% block page_title %}
{% with lesson_period.get_lesson_documentation as lesson_doc %}
<a href="{% url "week_view_by_week" lesson_doc.year lesson_doc.week "group" lesson_period.lesson.groups.all.0.pk %}"
class="btn-flat primary-color-text waves-light waves-effect">
class="btn-flat primary-color-text waves-light waves-effect">
<i class="material-icons left">chevron_left</i> {% trans "Back" %}
</a>
{% endwith %}
@@ -40,21 +40,17 @@
<div class="row">
<div class="col s12">
{% with prev_lesson=lesson_period.prev %}
<a class="btn-flat left waves-effect waves-light"
href="{% url "lesson_by_week_and_period" prev_lesson.week.year prev_lesson.week.week prev_lesson.id %}">
<i class="material-icons left">arrow_back</i>
{% trans "Previous lesson" %}
</a>
{% endwith %}
<a class="btn-flat left waves-effect waves-light"
href="{% url "lesson_by_week_and_period" prev_lesson.week.year prev_lesson.week.week prev_lesson.id %}">
<i class="material-icons left">arrow_back</i>
{% trans "Previous lesson" %}
</a>
{% with next_lesson=lesson_period.next %}
<a class="btn-flat right waves-effect waves-light"
href="{% url "lesson_by_week_and_period" next_lesson.week.year next_lesson.week.week next_lesson.id %}">
<i class="material-icons right">arrow_forward</i>
{% trans "Next lesson" %}
</a>
{% endwith %}
<a class="btn-flat right waves-effect waves-light"
href="{% url "lesson_by_week_and_period" next_lesson.week.year next_lesson.week.week next_lesson.id %}">
<i class="material-icons right">arrow_forward</i>
{% trans "Next lesson" %}
</a>
</div>
</div>
@@ -130,75 +126,74 @@
</div>
{% with prev_lesson=lesson_period.prev prev_doc=prev_lesson.get_lesson_documentation %}
{% with prev_doc=prev_lesson.get_lesson_documentation absences=prev_lesson.get_absences tardinesses=prev_lesson.get_tardinesses extra_marks=prev_lesson.get_extra_marks %}
{% has_perm "alsijil.view_lessondocumentation" user prev_lesson as can_view_prev_lesson_documentation %}
{% if prev_doc and can_view_prev_lesson_documentation %}
{% weekday_to_date prev_lesson.week prev_lesson.period.weekday as prev_date %}
<div class="col s12" id="previous-lesson">
<div class="card">
<div class="card-content">
{% with absences=prev_lesson.get_absences tardinesses=prev_lesson.get_tardinesses extra_marks=prev_lesson.get_extra_marks %}
{% has_perm "alsijil.view_lessondocumentation" user prev_lesson as can_view_prev_lesson_documentation %}
{% if prev_doc and can_view_prev_lesson_documentation %}
{% weekday_to_date prev_lesson.week prev_lesson.period.weekday as prev_date %}
<div class="col s12" id="previous-lesson">
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Overview: Previous lesson{% endblocktrans %} ({{ prev_date }},
{% blocktrans with period=prev_lesson.period.period %}{{ period }}. period{% endblocktrans %})
</span>
<table>
{% if prev_doc.topic %}
<tr>
<th class="collection-item">{% trans "Lesson topic of previous lesson:" %}</th>
<td>{{ prev_doc.topic }}</td>
</tr>
{% endif %}
<table>
{% if prev_doc.topic %}
<tr>
<th class="collection-item">{% trans "Lesson topic of previous lesson:" %}</th>
<td>{{ prev_doc.topic }}</td>
</tr>
{% endif %}
{% if prev_doc.homework %}
<tr>
<th class="collection-item">{% trans "Homework for this lesson:" %}</th>
<td>{{ prev_doc.homework }}</td>
</tr>
{% endif %}
{% if prev_doc.homework %}
<tr>
<th class="collection-item">{% trans "Homework for this lesson:" %}</th>
<td>{{ prev_doc.homework }}</td>
</tr>
{% endif %}
{% if prev_doc.group_note %}
<tr>
<th class="collection-item">{% trans "Group notes for previous lesson:" %}</th>
<td>{{ prev_doc.group_note }}</td>
</tr>
{% endif %}
{% if prev_doc.group_note %}
<tr>
<th class="collection-item">{% trans "Group notes for previous lesson:" %}</th>
<td>{{ prev_doc.group_note }}</td>
</tr>
{% endif %}
{% if absences %}
<tr>
<th>{% trans "Absent persons:" %}</th>
<td>{% include "alsijil/partials/absences.html" with notes=absences %}</td>
</tr>
{% endif %}
{% if absences %}
<tr>
<th>{% trans "Absent persons:" %}</th>
<td>{% include "alsijil/partials/absences.html" with notes=absences %}</td>
</tr>
{% endif %}
{% if tardinesses %}
<tr>
<th>{% trans "Late persons:" %}</th>
<td>{% include "alsijil/partials/tardinesses.html" with notes=tardinesses %}</td>
</tr>
{% endif %}
{% if tardinesses %}
<tr>
<th>{% trans "Late persons:" %}</th>
<td>{% include "alsijil/partials/tardinesses.html" with notes=tardinesses %}</td>
</tr>
{% endif %}
{% for extra_mark, notes in extra_marks.items %}
<tr>
<th>{{ extra_mark.name }}</th>
<td>
{% for note in notes %}
{% has_perm "alsijil.view_personalnote" user note as can_view_personalnote %}
{% if can_view_personalnote %}
<span>{{ note.person }}{% if not forloop.last %},{% endif %}</span>
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
{% for extra_mark, notes in extra_marks.items %}
<tr>
<th>{{ extra_mark.name }}</th>
<td>
{% for note in notes %}
{% has_perm "alsijil.view_personalnote" user note as can_view_personalnote %}
{% if can_view_personalnote %}
<span>{{ note.person }}{% if not forloop.last %},{% endif %}</span>
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</table>
</div>
{% endif %}
{% endwith %}
</div>
{% endif %}
{% endwith %}
{% endwith %}
{% if not lesson_period.get_substitution.cancelled or not request.site.preferences.alsijil__block_personal_notes_for_cancelled %}
<div class="col s12" id="personal-notes">
@@ -284,8 +279,8 @@
<td>{{ form.person_name.value }}</td>
<td><i class="material-icons center">{{ form.absent.value|yesno:"check,clear" }}</i></td>
<td>
<i class="material-icons center">{{ form.late.value|yesno:"check,clear" }}</i>
<span class="alsijil-tardiness-text">
<i class="material-icons center">{{ form.late.value|yesno:"check,clear" }}</i>
<span class="alsijil-tardiness-text">
{% if form.late.value %}{{ form.late.value|to_time|time:"i\m" }}{% endif %}
</span>
</td>
@@ -321,10 +316,10 @@
</div>
</div>
{% endif %}
</div>
</div>
{% if can_edit_lesson_documentation or can_edit_lesson_personalnote %}
<p>{% include "core/partials/save_button.html" %}</p>
{% endif %}
{% if can_edit_lesson_documentation or can_edit_lesson_personalnote %}
<p>{% include "core/partials/save_button.html" %}</p>
{% endif %}
</form>
{% endblock %}
Loading