fixed bug

This commit is contained in:
2026-03-16 08:30:05 +01:00
parent 7c5200e9a7
commit 1e349fcc56

View File

@@ -3,15 +3,23 @@ from ics import Calendar
td_titles = ["TD"]
sh_titles = ["ANGLAIS", "Anglais", "ETHIQUE"]
def _filter_group(name: str, titles: list[str], group: str) -> bool:
def _filter_group(name: str, titles: list[str], group: str) -> bool | None:
for title in titles:
if title in name:
return "Examen" in name or group == "all" or group in name
return True
return None
def _filter_event(name: str, td_group: str, sh_group: str) -> bool:
return _filter_group(name, td_titles, td_group) and _filter_group(name, sh_titles, sh_group)
res = _filter_group(name, sh_titles, sh_group)
if res:
return True
elif res == None:
if _filter_group(name, td_titles, td_group) != False:
return True
return False
def filter_calendar(calendar: Calendar, td_group: str, sh_group: str) -> Calendar:
filtered_calendar = Calendar()