From b4d7e9025ce647c87e33417f85c6aaeef3c7c3cc Mon Sep 17 00:00:00 2001 From: Belissimo_T Date: Fri, 2 Aug 2024 22:46:47 +0200 Subject: [PATCH] ical IV (cherry picked from commit 9e43602bce88b7d94d73af29a20b0c23ae63a6b0) --- endpoints/api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/endpoints/api.py b/endpoints/api.py index d0c7cef..4dc4155 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -190,6 +190,8 @@ def generate_html_list(elements: list[str]) -> str: calendar.add("x-wr-timezone", "Europe/Berlin") calendar.add("prodid", "-//VPlan FR//vplan.fr//DE") calendar.add("version", "2.0") + calendar.add("method", "PUBLISH") + calendar.add("calscale", "GREGORIAN") return Response( calendar.to_ical(), @@ -202,9 +204,12 @@ def generate_html_list(elements: list[str]) -> str: calendar.add("x-wr-timezone", "Europe/Berlin") calendar.add("prodid", "-//VPlan FR//vplan.fr//DE") calendar.add("version", "2.0") + calendar.add("method", "PUBLISH") + calendar.add("calscale", "GREGORIAN") today = datetime.date.today() for date in cache.get_days(): + break if date < today: continue @@ -215,7 +220,7 @@ def generate_html_list(elements: list[str]) -> str: lessons = data.get(plan_type, {}).get(plan_value, []) - for lesson in lessons: + for i, lesson in enumerate(lessons): if lesson["class_number"] in preferences: continue @@ -249,6 +254,8 @@ def generate_html_list(elements: list[str]) -> str: event.add("description", generate_html_list(info_paragraphs)) event.add("dtstart", begin) event.add("dtend", end) + event.add("dtstamp", datetime.datetime.now()) + event.add("uid", f"{school_num}_{plan_type}_{plan_value}_{date.isoformat()}_{i}@vplan.fr") if lesson["current_rooms"]: event.add("location", ", ".join(lesson["current_rooms"]))