Skip to content

Commit

Permalink
Display names of events (e.g. holidays) in the curriculum field
Browse files Browse the repository at this point in the history
  • Loading branch information
BelKed committed Jul 14, 2024
1 parent 2f60ea7 commit 046f096
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions edupage_api/timetables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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)

Expand Down

0 comments on commit 046f096

Please sign in to comment.