Skip to content
Snippets Groups Projects
Verified Commit 0df28697 authored by mirabilos's avatar mirabilos Committed by mirabilos
Browse files

This relation is complicated, let’s see what it does without.

(This adds back several dozen SQL queries, tbf later.)
parent 521daaac
No related branches found
No related tags found
No related merge requests found
......@@ -99,12 +99,11 @@ def group_week(request: HttpRequest, week: Optional[int] = None) -> HttpResponse
periods_by_day_unsorted = {}
if group:
for act_group in [group] + list(group.child_groups.all()):
for lesson in act_group.lessons.prefetch_related(
'lesson_period',
'lesson_period__period',
'lesson_period__period__lesson__teachers'
).filter(date_start__lte=week_start, date_end__gte=week_end):
for lesson_period in lesson.lesson_periods.all():
for lesson in act_group.lessons.filter(date_start__lte=week_start, date_end__gte=week_end):
for lesson_period in lesson.lesson_periods.select_related(
'period',
'period__lesson__teachers'
).all():
periods_by_day_unsorted.setdefault(
lesson_period.period.weekday, []).append(lesson_period)
......
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