From 046f09608e261c82b06874341eb3937157ada225 Mon Sep 17 00:00:00 2001 From: BelKed <66956532+BelKed@users.noreply.github.com> Date: Sun, 14 Jul 2024 19:01:15 +0200 Subject: [PATCH] Display names of events (e.g. holidays) in the `curriculum` field --- edupage_api/timetables.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/edupage_api/timetables.py b/edupage_api/timetables.py index f43e0bc..53e270b 100644 --- a/edupage_api/timetables.py +++ b/edupage_api/timetables.py @@ -22,8 +22,8 @@ class Lesson: groups: Optional[List[str]] teachers: Optional[List[EduTeacher]] classrooms: Optional[List[Classroom]] + curriculum: Optional[str] online_lesson_link: Optional[str] - curriculum: Optional[str] = None def is_online_lesson(self) -> bool: return self.online_lesson_link is not None @@ -188,7 +188,9 @@ def get_timetable(self, date: date) -> Optional[Timetable]: online_lesson_link = lesson.get("ol_url") - curriculum = lesson.get("flags", {}).get("dp0", {}).get("note_wd", None) + curriculum = lesson.get("flags", {}).get("dp0", {}).get( + "note_wd" + ) or lesson.get("flags", {}).get("event", {}).get("name") lesson_object = Lesson( period, @@ -199,8 +201,8 @@ def get_timetable(self, date: date) -> Optional[Timetable]: groups or None, teachers or None, classrooms or None, + curriculum or None, online_lesson_link, - curriculum, ) lessons.append(lesson_object)