From 2f26117f0f21625a20447d1280eb00b0a1007afc Mon Sep 17 00:00:00 2001 From: Belissimo_T Date: Fri, 2 Aug 2024 23:51:25 +0200 Subject: [PATCH] ical VIII (cherry picked from commit 862542fee4a566ee07ea4b5675537a6bed890cf3) --- endpoints/api.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/endpoints/api.py b/endpoints/api.py index e7208b7..045017e 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -174,7 +174,10 @@ def plan_ical(token: str) -> Response: import html def generate_html_list(elements: list[str]) -> str: - return "" + if not elements: + return "" + else: + return "" if plan_type != "forms": calendar = icalendar.Calendar() @@ -244,11 +247,10 @@ def generate_html_list(elements: list[str]) -> str: event = icalendar.Event() event.add("summary", summary) - if info_paragraphs: - event.add("description", ( - generate_html_list(info_paragraphs) - + f"
{datetime.datetime.now().isoformat()}" - )) + event.add("description", ( + generate_html_list(info_paragraphs) + + f"
{datetime.datetime.now().isoformat()}" + )) event.add("dtstart", begin) event.add("dtend", end) event.add("dtstamp", datetime.datetime.now())