Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
ignore lesson if lesson.subjects is empty
  • Loading branch information
JonasJoKuJonas committed Nov 6, 2022
1 parent e8a8491 commit 43df74c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/webuntis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _is_class(self):

for lesson in table:
# pylint: disable=maybe-no-member
if lesson.start < now < lesson.end and lesson.code != "cancelled":
if lesson.start < now < lesson.end and lesson.code != "cancelled" and lesson.subjects != "":
return True
return False

Expand All @@ -245,7 +245,7 @@ def _next_class(self):

time_list = []
for lesson in table:
if lesson.start > now and lesson.code != "cancelled":
if lesson.start > now and lesson.code != "cancelled" and lesson.subjects != "":
time_list.append(lesson.start)

return sorted(time_list)[0].astimezone()
Expand All @@ -260,7 +260,7 @@ def _first_class(self):

time_list = []
for lesson in table:
if lesson.code != "cancelled":
if lesson.code != "cancelled" and lesson.subjects != "":
time_list.append(lesson.start)

if len(time_list) > 1:
Expand All @@ -280,7 +280,7 @@ def _next_lesson_to_wake_up(self):

time_list = []
for lesson in table:
if lesson.code != "cancelled":
if lesson.code != "cancelled" and lesson.subjects != "":
time_list.append(lesson.start)

day = now
Expand Down

0 comments on commit 43df74c

Please sign in to comment.