From 43df74c477a12995381a9ff5814319a18d9529fa Mon Sep 17 00:00:00 2001 From: Jonas <86736063+JonasJoKuJonas@users.noreply.github.com> Date: Sun, 6 Nov 2022 21:06:47 +0100 Subject: [PATCH] Update __init__.py ignore lesson if lesson.subjects is empty --- custom_components/webuntis/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/webuntis/__init__.py b/custom_components/webuntis/__init__.py index 7a39ab0..d03db05 100644 --- a/custom_components/webuntis/__init__.py +++ b/custom_components/webuntis/__init__.py @@ -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 @@ -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() @@ -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: @@ -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