From 44f26ec68694b248ad22be01d2519c970c314858 Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Mon, 29 Jul 2019 22:42:45 +0200 Subject: [PATCH] Last event changes --- biscuit/apps/untis/sub.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/biscuit/apps/untis/sub.py b/biscuit/apps/untis/sub.py index 50e59d7..c16bafc 100644 --- a/biscuit/apps/untis/sub.py +++ b/biscuit/apps/untis/sub.py @@ -246,7 +246,7 @@ class HeaderInformation: self.affected_teachers) > 0 or len(self.affected_classes) > 0 -def get_header_information(subs, date): +def get_header_information(subs, date, events=[]): """ Get header information like affected teachers/classes and missing teachers/classes for a given date :param date: The date as datetime object @@ -267,6 +267,15 @@ def get_header_information(subs, date): if _class not in info.affected_classes: info.affected_classes.append(_class) + for event in events: + for teacher in event.teachers: + if teacher.id not in [x.id for x in info.affected_teachers]: + info.affected_teachers.append(teacher) + + for _class in event.classes: + if _class.id not in [x.id for x in info.affected_classes]: + info.affected_classes.append(_class) + # Get all absences that are relevant for this day info.absences = get_all_absences_by_date(date) -- GitLab