WIP: lien saisie abs sur EDT.

This commit is contained in:
Emmanuel Viennet 2023-11-12 21:45:06 +01:00
parent 0f61b0874a
commit bf096d4648

View File

@ -33,7 +33,7 @@ XXX usage uniquement experimental pour tests implémentations
import re
import icalendar
from flask import flash
from flask import flash, g, url_for
from app import log
from app.models import FormSemestre, GroupDescr, ModuleImpl, ScoDocSiteConfig
import app.scodoc.sco_utils as scu
@ -126,15 +126,30 @@ def formsemestre_edt_dict(formsemestre: FormSemestre) -> list[dict]:
edt_module = extract_event_module(event)
modimpl: ModuleImpl = edt2modimpl.get(edt_module, None)
mod_disp = (
f"""<div class="module-edt mod-name" title="{modimpl.module.abbrev or ""}">{modimpl.module.code}
</div>"""
f"""<div class="module-edt mod-name" title="{modimpl.module.abbrev or ""}">{
modimpl.module.code}</div>"""
if modimpl
else f"""<div class="module-edt mod-etd" title="vérifier code edt module ?">{scu.EMO_WARNING} {edt_module}</div>"""
else f"""<div class="module-edt mod-etd" title="vérifier code edt module ?">{
scu.EMO_WARNING} {edt_module}</div>"""
)
# --- Lien saisie abs
link_abs = (
f"""<div class="module-edt link-abs"><a class="stdlink" href="{
url_for("assiduites.visu_assiduites_group",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre.id,
moduleimpl_id=modimpl.id,
jour = event.decoded("dtstart").isoformat(),
group_ids=group.id,
)}">absences</a>
</div>"""
if modimpl and group
else ""
)
d = {
# Champs utilisés par tui.calendar
"calendarId": "cal1",
"title": extract_event_title(event) + group_disp + mod_disp,
"title": extract_event_title(event) + group_disp + mod_disp + link_abs,
"start": event.decoded("dtstart").isoformat(),
"end": event.decoded("dtend").isoformat(),
"backgroundColor": background_color,