Skip to content

Commit

Permalink
ical IV
Browse files Browse the repository at this point in the history
(cherry picked from commit 9e43602)
  • Loading branch information
Belissimo-T committed Aug 2, 2024
1 parent 9b57486 commit b4d7e90
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion endpoints/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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"]))
Expand Down

0 comments on commit b4d7e90

Please sign in to comment.