Skip to content
Commits on Source (10)
......@@ -6,6 +6,22 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.
`2.0`_ - 2021-10-30
-------------------
Changed
~~~~~~~
* Improve the formatting of the print version of the substitution plan
* Reduce the page margin.
* Reduce the space between the header and the heading.
* Display block of absences as a table.
Fixed
~~~~~
* Do not show substitutions on regular timetables.
`2.0rc3`_ - 2021-09-24
----------------------
......@@ -211,3 +227,4 @@ Fixed
.. _2.0rc1: https://edugit.org/AlekSIS/Official/AlekSIS-App-Chronos/-/tags/2.0rc1
.. _2.0rc2: https://edugit.org/AlekSIS/Official/AlekSIS-App-Chronos/-/tags/2.0rc2
.. _2.0rc3: https://edugit.org/AlekSIS/Official/AlekSIS-App-Chronos/-/tags/2.0rc3
.. _2.0: https://edugit.org/AlekSIS/Official/AlekSIS-App-Chronos/-/tags/2.0
......@@ -319,7 +319,7 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin):
| Q(**{self._period_path + "lesson__groups__parent_groups__in": groups})
)
def filter_teacher(self, teacher: Union[Person, int]):
def filter_teacher(self, teacher: Union[Person, int], is_smart: bool = True):
"""Filter for all lessons given by a certain teacher."""
qs1 = self.filter(**{self._period_path + "lesson__teachers": teacher})
qs2 = self.filter(
......@@ -330,9 +330,12 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin):
}
)
return qs1.union(qs2)
if is_smart:
return qs1.union(qs2)
else:
return qs1
def filter_room(self, room: Union["Room", int]):
def filter_room(self, room: Union["Room", int], is_smart: bool = True):
"""Filter for all lessons taking part in a certain room."""
qs1 = self.filter(**{self._period_path + "room": room})
qs2 = self.filter(
......@@ -343,18 +346,21 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin):
}
)
return qs1.union(qs2)
if is_smart:
return qs1.union(qs2)
else:
return qs1
def filter_from_type(
self, type_: TimetableType, obj: Union[Person, Group, "Room", int]
self, type_: TimetableType, obj: Union[Person, Group, "Room", int], is_smart: bool = True
) -> Optional[models.QuerySet]:
"""Filter lesson data for a group, teacher or room by provided type."""
if type_ == TimetableType.GROUP:
return self.filter_group(obj)
elif type_ == TimetableType.TEACHER:
return self.filter_teacher(obj)
return self.filter_teacher(obj, is_smart=is_smart)
elif type_ == TimetableType.ROOM:
return self.filter_room(obj)
return self.filter_room(obj, is_smart=is_smart)
else:
return None
......
......@@ -103,8 +103,9 @@ table.substitutions td, table.substitutions th {
width: 30%;
}
.print-body table.substitutions td, .print-body table.substitutions th {
padding: 0 2px;
padding: 0;
}
.print-body span.badge.new {
......@@ -138,3 +139,24 @@ table.substitutions td, table.substitutions th {
.holiday-card .holiday-badge {
margin-top: 0;
}
@media print {
header {
width: 200mm;
top: 5mm;
}
.header-space {
height: 30mm;
}
.sheet {
padding: 5mm;
}
.print-layout-table, .print-layout-table > td {
width: 200mm;
max-width: 200mm;
min-width: 200mm;
}
}
......@@ -5,48 +5,48 @@
<div class="{% if not print %}card-content{% endif %}">
{% if absent_teachers %}
<div class="row no-margin">
<div class="col s12 m3">
<div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
<strong class="truncate">
{% trans "Absent teachers" %}
</strong>
</div>
<div class="col s12 m9 black-text-a">
<div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
{% include "chronos/partials/teachers.html" with teachers=absent_teachers %}
</div>
</div>
{% endif %}
{% if absent_groups %}
<div class="row no-margin">
<div class="col s12 m3">
<div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
<strong class="truncate">
{% trans "Absent groups" %}
</strong>
</div>
<div class="col s12 m9 black-text-a">
<div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
{% include "chronos/partials/groups.html" with groups=absent_groups no_collapsible=True %}
</div>
</div>
{% endif %}
{% if affected_teachers %}
<div class="row no-margin">
<div class="col s12 m3">
<div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
<strong class="truncate">
{% trans "Affected teachers" %}
</strong>
</div>
<div class="col s12 m9 black-text-a">
<div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
{% include "chronos/partials/teachers.html" with teachers=affected_teachers %}
</div>
</div>
{% endif %}
{% if affected_groups %}
<div class="row no-margin">
<div class="col s12 m3">
<div class="col {% if not print %}s12 m3{% else %}s3{% endif %}">
<strong class="truncate">
{% trans "Affected groups" %}
</strong>
</div>
<div class="col s12 m9 black-text-a">
<div class="col {% if not print %}s12 m9{% else %}s9{% endif %} black-text-a">
{% include "chronos/partials/groups.html" with groups=affected_groups no_collapsible=True %}
</div>
</div>
......
......@@ -14,7 +14,7 @@
{% block content %}
{% for day, c in days.items %}
<h4>{% trans "Substitutions" %} {{ c.day|date:"l" }} {{ c.day }}</h4>
<h4>{{ c.day|date:"l" }} {{ c.day|date:"SHORT_DATE_FORMAT" }}</h4>
{% include "core/partials/announcements.html" with announcements=announcements show_recipients=1 %}
......
......@@ -76,7 +76,7 @@ def build_timetable(
if is_person:
lesson_periods = lesson_periods.filter_from_person(obj)
else:
lesson_periods = lesson_periods.filter_from_type(type_, obj)
lesson_periods = lesson_periods.filter_from_type(type_, obj, is_smart=with_holidays)
# Sort lesson periods in a dict
lesson_periods_per_period = lesson_periods.group_by_periods(is_week=is_week)
......
This diff is collapsed.
This diff is collapsed.
[tool.poetry]
name = "AlekSIS-App-Chronos"
version = "2.0rc3"
version = "2.0"
packages = [
{ include = "aleksis" }
]
......@@ -27,7 +27,7 @@ repository = "https://edugit.org/AlekSIS/official/AlekSIS-App-Chronos"
documentation = "https://aleksis.org/AlekSIS/docs/html/"
keywords = ["SIS", "education", "school", "timetable", "plans"]
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django :: 3.0",
"Intended Audience :: Education",
......@@ -43,7 +43,7 @@ secondary = true
[tool.poetry.dependencies]
python = "^3.9"
calendarweek = "^0.5.0"
aleksis-core = "^2.0rc"
aleksis-core = "^2.0"
[tool.poetry.dev-dependencies]
aleksis-builddeps = "*"
......