From eaa82f61a449e00a68701936f82a10f7362e2661 Mon Sep 17 00:00:00 2001 From: "pascal.bouron" Date: Wed, 23 Oct 2024 22:45:34 +0200 Subject: [PATCH] Actualiser app/scodoc/sco_edt_cal.py Proposition https://git.scodoc.org/ScoDoc/ScoDoc/issues/1001 Signed-off-by: pascal.bouron --- app/scodoc/sco_edt_cal.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/app/scodoc/sco_edt_cal.py b/app/scodoc/sco_edt_cal.py index 91e3d6561..e81ac838e 100644 --- a/app/scodoc/sco_edt_cal.py +++ b/app/scodoc/sco_edt_cal.py @@ -42,6 +42,7 @@ from flask import g, url_for from app import log from app.auth.models import User from app.models import FormSemestre, GroupDescr, ModuleImpl, ScoDocSiteConfig +from app.scodoc.html_sidebar import retreive_formsemestre_from_request from app.scodoc.sco_exceptions import ScoValueError import app.scodoc.sco_utils as scu @@ -222,18 +223,23 @@ def translate_calendar( if group and group_ids_set and group.id not in group_ids_set: continue # ignore cet évènement modimpl: ModuleImpl | bool = event["modimpl"] - url_abs = ( - url_for( - "assiduites.signal_assiduites_group", - scodoc_dept=g.scodoc_dept, - group_ids=group.id, - heure_deb=event["heure_deb"], - heure_fin=event["heure_fin"], - moduleimpl_id=modimpl.id, - day=event["jour"], - ) - if modimpl and group - else None + params = { + "scodoc_dept": g.scodoc_dept, + "group_ids": group.id, + "heure_deb": event["heure_deb"].replace("h", ":") if "h" in event["heure_deb"] else event["heure_deb"], + "heure_fin": event["heure_fin"].replace("h", ":") if "h" in event["heure_fin"] else event["heure_fin"], + "day": event["jour"] + } + if modimpl: + params["moduleimpl_id"] = modimpl.id + else: + params["formsemestre_id"] = retreive_formsemestre_from_request() + + # Génération de l'URL si group et l'un des deux (modimpl ou formsem) sont définis + url_abs = ( + url_for("assiduites.signal_assiduites_group", **params) + if group + else None ) match modimpl: case False: # EDT non configuré