Skip to content
Snippets Groups Projects
Commit e89558a7 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Merge branch 'master' into 58-models-for-advanced-features-from-schoolapps-imported-from-untis

parents 6b42a024 8cbb193c
No related branches found
No related tags found
1 merge request!39Resolve "Models for advanced features from SchoolApps (imported from Untis)"
......@@ -255,12 +255,17 @@ class LessonSubstitutionQuerySet(LessonDataQuerySet):
def affected_teachers(self):
""" Return all teachers which are affected by selected substitutions (as substituted or substituting) """
return Person.objects.filter(Q(lessons_as_teacher__in=self.affected_lessons()) | Q(lesson_substitutions__in=self))
return Person.objects.filter(
Q(lessons_as_teacher__in=self.affected_lessons())
| Q(lesson_substitutions__in=self)
).annotate(lessons_count=Count("lessons_as_teacher"))
def affected_groups(self):
""" Return all groups which are affected by selected substitutions """
return Group.objects.filter(lessons__in=self.affected_lessons())
return Group.objects.filter(lessons__in=self.affected_lessons()).annotate(
lessons_count=Count("lessons")
)
class TimePeriod(models.Model):
......
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