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

Show groups in overview also if they have child groups with lessons ("courses" with lessons)

parent 2c9fd696
No related branches found
No related tags found
1 merge request!45Improve handling of child/parent groups
This commit is part of merge request !45. Comments created here will be created in the context of that merge request.
......@@ -30,8 +30,12 @@ def all_timetables(request: HttpRequest) -> HttpResponse:
teachers = Person.objects.annotate(
lessons_count=Count("lessons_as_teacher")
).filter(lessons_count__gt=0)
classes = Group.objects.annotate(lessons_count=Count("lessons")).filter(
lessons_count__gt=0, parent_groups=None
groups = Group.objects.annotate(
lessons_count=Count("lessons"),
child_lessons_count=Count("child_groups__lessons"),
)
classes = groups.filter(lessons_count__gt=0, parent_groups=None) | groups.filter(
child_lessons_count__gt=0, parent_groups=None
)
rooms = Room.objects.annotate(lessons_count=Count("lesson_periods")).filter(
lessons_count__gt=0
......
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