Actualiser app/scodoc/sco_edt_cal.py

Proposition #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.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é