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

Add some small bug fixes for queries

parent 50fd338d
No related branches found
No related tags found
1 merge request!78Add some small bug fixes for queries
Pipeline #3337 passed
......@@ -36,7 +36,7 @@ class ValidityRangeRelatedQuerySet(QuerySet):
def for_validity_range(
self, validity_range: "ValidityRange"
) -> "ValidityRangeRelatedQuerySet":
return self.filter(validity_range=validity_range)
return self.filter(validity=validity_range)
def for_current_or_all(self) -> "ValidityRangeRelatedQuerySet":
"""Get all objects related to current validity range.
......
......@@ -379,7 +379,7 @@ class LessonSubstitution(ExtensibleModel):
@property
def date(self):
week = CalendarWeek(week=self.week, year=self.lesson_period.lesson.get_year())
week = CalendarWeek(week=self.week, year=self.lesson_period.lesson.get_year(self.week))
return week[self.lesson_period.period.weekday]
def __str__(self):
......
......@@ -33,7 +33,7 @@ def all_timetables(request: HttpRequest) -> HttpResponse:
teachers = Person.objects.annotate(
lessons_count=Count("lessons_as_teacher")
).filter(lessons_count__gt=0)
groups = Group.objects.annotate(
groups = Group.objects.for_current_school_term_or_all().annotate(
lessons_count=Count("lessons"),
child_lessons_count=Count("child_groups__lessons"),
)
......
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