Skip to content

Commit

Permalink
Prevent crash on empty classrooms route when timetable is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
filips123 committed Aug 31, 2022
1 parent c13e759 commit e5d0b62
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions API/gimvicurnik/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ def get_empty(cls) -> Iterator[Dict[str, Any]]:
days = (1, 5)
times = Session.query(func.min(Lesson.time), func.max(Lesson.time))[0]

if times[0] is None or times[1] is None:
return []

classrooms = list(Session.query(Classroom).order_by(Classroom.name))
lessons = list(Session.query(Lesson).join(Classroom))

Expand Down

0 comments on commit e5d0b62

Please sign in to comment.