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,17 +223,22 @@ 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"]
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_abs = (
url_for( url_for("assiduites.signal_assiduites_group", **params)
"assiduites.signal_assiduites_group", if 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 else None
) )
match modimpl: match modimpl: