From 013b74c1c28cb3bc956bf78930f81469b18ccace Mon Sep 17 00:00:00 2001 From: Jonas Date: Sun, 27 Oct 2024 21:18:38 +0100 Subject: [PATCH] fixed no teacher error --- custom_components/webuntis/notify.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/webuntis/notify.py b/custom_components/webuntis/notify.py index 15389eb..f975324 100644 --- a/custom_components/webuntis/notify.py +++ b/custom_components/webuntis/notify.py @@ -234,9 +234,11 @@ def get_changes(change, lesson, lesson_old, server): else: name = lesson["subjects"][0]["name"] - changes["subject"] = get_lesson_name_str( - server=server, name=name, teacher=lesson["teachers"][0]["name"] - ) + teacher = None + if "teachers" not in server.exclude_data: + teacher = lesson["teachers"][0]["name"] + + changes["subject"] = get_lesson_name_str(server=server, name=name, teacher=teacher) changes["date"] = lesson["start"].strftime("%d.%m.%Y") changes["time_start"] = lesson["start"].strftime("%H:%M")