Actualiser app/scodoc/sco_edt_cal.py

Proposition ScoDoc/ScoDoc#1001

Signed-off-by: pascal.bouron <pascal.bouron@noreply@scodoc.org>
This commit is contained in:
pascal.bouron 2024-10-23 22:45:34 +02:00
parent ec82d27e1f
commit eaa82f61a4

View File

@ -42,6 +42,7 @@ from flask import g, url_for
from app import log from app import log
from app.auth.models import User from app.auth.models import User
from app.models import FormSemestre, GroupDescr, ModuleImpl, ScoDocSiteConfig 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 from app.scodoc.sco_exceptions import ScoValueError
import app.scodoc.sco_utils as scu 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: if group and group_ids_set and group.id not in group_ids_set:
continue # ignore cet évènement continue # ignore cet évènement
modimpl: ModuleImpl | bool = event["modimpl"] modimpl: ModuleImpl | bool = event["modimpl"]
url_abs = ( params = {
url_for( "scodoc_dept": g.scodoc_dept,
"assiduites.signal_assiduites_group", "group_ids": group.id,
scodoc_dept=g.scodoc_dept, "heure_deb": event["heure_deb"].replace("h", ":") if "h" in event["heure_deb"] else event["heure_deb"],
group_ids=group.id, "heure_fin": event["heure_fin"].replace("h", ":") if "h" in event["heure_fin"] else event["heure_fin"],
heure_deb=event["heure_deb"], "day": event["jour"]
heure_fin=event["heure_fin"], }
moduleimpl_id=modimpl.id, if modimpl:
day=event["jour"], params["moduleimpl_id"] = modimpl.id
) else:
if modimpl and group params["formsemestre_id"] = retreive_formsemestre_from_request()
else None
# 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: match modimpl:
case False: # EDT non configuré case False: # EDT non configuré