EDT: ajout aide + option pour ne pas afficher les titres de modules

This commit is contained in:
Emmanuel Viennet 2023-12-24 16:09:07 +01:00
parent 95a2a3daeb
commit 4cb7479b6f
8 changed files with 311 additions and 18 deletions

View File

@ -569,10 +569,14 @@ def formsemestre_edt(formsemestre_id: int):
Si ok, une liste d'évènements. Sinon, une chaine indiquant un message d'erreur.
group_ids permet de filtrer sur les groupes ScoDoc.
show_modules_titles affiche le titre complet du module (défaut), sinon juste le code.
"""
query = FormSemestre.query.filter_by(id=formsemestre_id)
if g.scodoc_dept:
query = query.filter_by(dept_id=g.scodoc_dept_id)
formsemestre: FormSemestre = query.first_or_404(formsemestre_id)
group_ids = request.args.getlist("group_ids", int)
return sco_edt_cal.formsemestre_edt_dict(formsemestre, group_ids=group_ids)
show_modules_titles = scu.to_bool(request.args.get("show_modules_titles", False))
return sco_edt_cal.formsemestre_edt_dict(
formsemestre, group_ids=group_ids, show_modules_titles=show_modules_titles
)

View File

@ -115,7 +115,9 @@ _EVENT_DEFAULT_COLOR = "rgb(214, 233, 248)"
def formsemestre_edt_dict(
formsemestre: FormSemestre, group_ids: list[int] = None
formsemestre: FormSemestre,
group_ids: list[int] = None,
show_modules_titles=True,
) -> list[dict]:
"""EDT complet du semestre, comme une liste de dict serialisable en json.
Fonction appelée par l'API /formsemestre/<int:formsemestre_id>/edt
@ -126,10 +128,12 @@ def formsemestre_edt_dict(
"""
group_ids_set = set(group_ids) if group_ids else set()
try:
events_scodoc = _load_and_convert_ics(formsemestre)
events_scodoc, _ = load_and_convert_ics(formsemestre)
except ScoValueError as exc:
return exc.args[0]
# Génération des événements pour le calendrier html
promo_icon = f"""<img height="24px" src="{scu.STATIC_DIR}/icons/promo.svg"
title="promotion complète" alt="promotion"/>"""
events_cal = []
for event in events_scodoc:
group: GroupDescr | bool = event["group"]
@ -140,7 +144,7 @@ def formsemestre_edt_dict(
</div>"""
else:
group_disp = (
f"""<div class="group-name">{group.get_nom_with_part(default="promo")}</div>"""
f"""<div class="group-name">{group.get_nom_with_part(default=promo_icon)}</div>"""
if group
else f"""<div class="group-edt">{event['edt_group']}
<span title="vérifier noms de groupe ou configuration extraction edt">
@ -173,13 +177,14 @@ def formsemestre_edt_dict(
scu.EMO_WARNING} {event['edt_module']}</span>"""
bubble = "code module non trouvé dans ScoDoc. Vérifier configuration."
case _: # module EDT bien retrouvé dans ScoDoc
mod_disp = f"""<span class="mod-name mod-code" title="{
modimpl.module.abbrev or ""} ({event['edt_module']})">{
modimpl.module.code}</span>"""
bubble = f"{modimpl.module.abbrev or ''} ({event['edt_module']})"
title = f"""<div class = "module-edt" title="{bubble} {event['title_edt']}">
<a class="discretelink" href="{url_abs or ''}">{mod_disp} <span>{event['title']}</span></a>
bubble = f"{modimpl.module.abbrev or modimpl.module.titre or ''} ({event['edt_module']})"
mod_disp = (
f"""<span class="mod-name mod-code">{modimpl.module.code}</span>"""
)
# {event['title_edt']}
span_title = f" <span>{event['title']}</span>" if show_modules_titles else ""
title = f"""<div class = "module-edt" title="{bubble}">
<a class="discretelink" href="{url_abs or ''}">{mod_disp}{span_title}</a>
</div>
"""
@ -208,8 +213,15 @@ def formsemestre_edt_dict(
return events_cal
def _load_and_convert_ics(formsemestre: FormSemestre) -> list[dict]:
"chargement fichier, filtrage et extraction des identifiants."
def load_and_convert_ics(formsemestre: FormSemestre) -> tuple[list[dict], list[str]]:
"""Chargement fichier ics, filtrage et extraction des identifiants.
Renvoie une liste d'évènements, et la liste des identifiants de groupes
trouvés (utilisée pour l'aide).
Groupes:
- False si extraction regexp non configuré
- "tous" (promo) si pas de correspondance trouvée.
"""
# Chargement du calendier ics
_, calendar = formsemestre_load_calendar(formsemestre)
if not calendar:
@ -251,6 +263,7 @@ def _load_and_convert_ics(formsemestre: FormSemestre) -> list[dict]:
group_name: _COLOR_PALETTE[i % (len(_COLOR_PALETTE) - 1) + 1]
for i, group_name in enumerate(edt2group)
}
edt_groups_ids = set() # les ids de groupes tels que dans l'ics
default_group = formsemestre.get_default_group()
edt2modimpl = formsemestre_retreive_modimpls_from_edt_id(formsemestre)
# ---
@ -271,6 +284,7 @@ def _load_and_convert_ics(formsemestre: FormSemestre) -> list[dict]:
edt_group = extract_event_data(
event, edt_ics_group_field, edt_ics_group_pattern
)
edt_groups_ids.add(edt_group)
# si pas de groupe dans l'event, ou si groupe non reconnu,
# prend toute la promo ("tous")
group: GroupDescr = (
@ -324,7 +338,7 @@ def _load_and_convert_ics(formsemestre: FormSemestre) -> list[dict]:
"end": event.decoded("dtend").isoformat(),
}
)
return events_sco
return events_sco, sorted(edt_groups_ids)
def extract_event_data(

View File

@ -1,3 +1,8 @@
#show_modules_titles_form {
display: inline-block;
margin-left: 16px;
}
.toastui-calendar-template-time {
padding: 4px;
word-break: break-all;

140
app/static/icons/promo.svg Normal file
View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<g>
<g>
<ellipse style="fill:#F1DBC8;" cx="194.5" cy="111.67" rx="35.396" ry="35.671"/>
<ellipse style="fill:#F1DBC8;" cx="317.5" cy="111.67" rx="35.396" ry="35.671"/>
</g>
<path style="fill:#FF916C;" d="M250.277,172.685c-8.091-15.056-23.918-25.342-42.015-25.342H194.5h-13.764
c-18.097,0-33.924,10.286-42.014,25.342c16.826,2.757,29.673,17.471,29.673,35.208c0,19.701-15.848,35.671-35.395,35.671h13.763
c18.097,0,33.925,10.286,42.014,25.339c1.863-0.305,3.774-0.464,5.724-0.464c1.948,0,3.86,0.159,5.723,0.467
c8.09-15.056,23.917-25.342,42.014-25.342H256c-19.549,0-35.397-15.97-35.397-35.671
C220.603,190.155,233.449,175.441,250.277,172.685z"/>
<path style="fill:#C22C65;" d="M303.736,147.343c-18.097,0-33.924,10.286-42.014,25.342c16.827,2.757,29.673,17.471,29.673,35.208
c0,19.701-15.848,35.671-35.395,35.671h13.763c18.097,0,33.924,10.286,42.014,25.339c1.863-0.305,3.774-0.464,5.724-0.464
c1.948,0,3.859,0.159,5.723,0.467c8.09-15.056,23.917-25.342,42.014-25.342H379c-19.549,0-35.396-15.97-35.396-35.671
c0-17.737,12.846-32.451,29.673-35.208c-8.091-15.056-23.918-25.342-42.015-25.342H317.5L303.736,147.343L303.736,147.343z"/>
<g>
<path style="fill:#F1DBC8;" d="M168.395,207.893c0-17.737-12.847-32.451-29.673-35.208c-1.863-0.306-3.774-0.464-5.723-0.464
c-19.549,0-35.396,15.971-35.396,35.672s15.847,35.671,35.396,35.671S168.395,227.594,168.395,207.893z"/>
<path style="fill:#F1DBC8;" d="M250.277,172.685c-16.828,2.757-29.674,17.471-29.674,35.208c0,19.701,15.848,35.671,35.397,35.671
c19.548,0,35.395-15.97,35.395-35.671c0-17.737-12.846-32.451-29.673-35.208c-1.863-0.306-3.775-0.464-5.723-0.464
C254.052,172.221,252.14,172.379,250.277,172.685z"/>
<path style="fill:#F1DBC8;" d="M373.277,172.685c-16.827,2.757-29.673,17.471-29.673,35.208c0,19.701,15.847,35.671,35.396,35.671
c19.548,0,35.396-15.97,35.396-35.671S398.548,172.221,379,172.221C377.052,172.221,375.14,172.379,373.277,172.685z"/>
</g>
<path style="fill:#55CD8E;" d="M188.776,268.902c-8.089-15.053-23.917-25.339-42.014-25.339H133h-13.764
c-18.097,0-33.924,10.286-42.014,25.339c16.827,2.758,29.673,17.471,29.673,35.208c0,19.701-15.848,35.672-35.395,35.672h13.763
c26.256,0,47.737,21.648,47.737,48.108c0-26.46,21.481-48.108,47.736-48.108H194.5c-19.549,0-35.397-15.971-35.397-35.672
C159.103,286.373,171.949,271.66,188.776,268.902z"/>
<path style="fill:#876E67;" d="M242.236,243.564c-18.097,0-33.924,10.286-42.014,25.339c16.827,2.758,29.672,17.471,29.672,35.208
c0,19.701-15.847,35.672-35.394,35.672h13.763c26.255,0,47.737,21.648,47.737,48.108c0-26.46,21.481-48.108,47.736-48.108H317.5
c-19.549,0-35.396-15.971-35.396-35.672c0-17.737,12.845-32.45,29.672-35.205c-8.09-15.056-23.917-25.342-42.014-25.342H256
L242.236,243.564L242.236,243.564z"/>
<path style="fill:#4BC1D7;" d="M323.223,268.902c16.827,2.758,29.673,17.471,29.673,35.208c0,19.701-15.848,35.672-35.396,35.672
h13.763c26.256,0,47.737,21.648,47.737,48.108c0-26.46,21.481-48.108,47.736-48.108H440.5c-19.549,0-35.397-15.971-35.397-35.672
c0-17.737,12.846-32.45,29.674-35.205c-8.091-15.056-23.918-25.342-42.015-25.342H379h-13.764
C347.14,243.564,331.313,253.85,323.223,268.902z"/>
<g>
<path style="fill:#F1DBC8;" d="M71.5,339.782c19.548,0,35.395-15.971,35.395-35.672c0-17.737-12.846-32.45-29.673-35.208
c-1.863-0.305-3.774-0.464-5.723-0.464c-19.549,0-35.396,15.972-35.396,35.672C36.104,323.812,51.951,339.782,71.5,339.782z"/>
<path style="fill:#F1DBC8;" d="M159.103,304.11c0,19.701,15.848,35.672,35.397,35.672c19.548,0,35.394-15.971,35.394-35.672
c0-17.737-12.845-32.45-29.672-35.208c-1.862-0.305-3.774-0.464-5.723-0.464s-3.86,0.159-5.724,0.464
C171.949,271.66,159.103,286.373,159.103,304.11z"/>
<path style="fill:#F1DBC8;" d="M282.104,304.11c0,19.701,15.847,35.672,35.396,35.672c19.548,0,35.396-15.971,35.396-35.672
c0-17.737-12.846-32.45-29.673-35.208c-1.863-0.305-3.774-0.464-5.723-0.464s-3.86,0.159-5.724,0.467
C294.949,271.66,282.104,286.373,282.104,304.11z"/>
<path style="fill:#F1DBC8;" d="M405.103,304.11c0,19.701,15.848,35.672,35.397,35.672c19.548,0,35.395-15.971,35.395-35.672
c0-19.7-15.847-35.672-35.395-35.672c-1.949,0-3.86,0.159-5.723,0.467C417.949,271.66,405.103,286.373,405.103,304.11z"/>
</g>
<path style="fill:#BDD377;" d="M426.736,339.782c-26.255,0-47.736,21.648-47.736,48.108V436h123v-48.109
c0-26.46-21.482-48.108-47.737-48.108H440.5L426.736,339.782L426.736,339.782z"/>
<path style="fill:#FFBD50;" d="M379,387.891c0-26.46-21.481-48.108-47.737-48.108H317.5h-13.764
c-26.255,0-47.736,21.648-47.736,48.108V436h123V387.891z"/>
<path style="fill:#76C8D6;" d="M256,387.891c0-26.46-21.482-48.108-47.737-48.108H194.5h-13.764
c-26.255,0-47.736,21.648-47.736,48.108V436h123V387.891z"/>
<path style="fill:#F13D7C;" d="M133,387.891c0-26.46-21.481-48.108-47.737-48.108H71.5H57.736
C31.481,339.782,10,361.431,10,387.891V436h123V387.891z"/>
</g>
<path d="M432.234,388.82h-0.236c-5.522,0-10,4.478-10,10s4.478,10,10,10h0.236c5.522,0,10-4.478,10-10
S437.757,388.82,432.234,388.82z"/>
<path d="M501.999,446c5.523,0,10-4.478,10-10v-37.162c0-0.007,0.001-0.013,0.001-0.02s-0.001-0.013-0.001-0.02V387.89
c0-24.602-15.375-45.666-37.015-54.129c6.793-7.986,10.91-18.341,10.91-29.651c0-25.184-20.364-45.672-45.395-45.672
c-0.145,0-0.287,0.01-0.431,0.011c-6.659-9.589-15.928-16.842-26.524-20.975c6.758-7.977,10.851-18.305,10.851-29.582
c0-25.184-20.364-45.672-45.396-45.672c-0.144,0-0.285,0.01-0.429,0.011c-6.659-9.591-15.929-16.845-26.526-20.978
c6.758-7.977,10.851-18.305,10.851-29.583C362.896,86.488,342.531,66,317.5,66s-45.396,20.488-45.396,45.671
c0,11.278,4.093,21.607,10.851,29.583c-10.599,4.133-19.867,11.387-26.527,20.978c-0.143-0.001-0.285-0.011-0.428-0.011
c-0.144,0-0.286,0.01-0.429,0.011c-6.66-9.591-15.929-16.845-26.527-20.978c6.758-7.977,10.851-18.305,10.851-29.583
C239.894,86.488,219.531,66,194.5,66c-25.032,0-45.397,20.488-45.397,45.671c0,11.278,4.093,21.607,10.851,29.583
c-10.598,4.133-19.867,11.387-26.526,20.978c-0.143-0.001-0.285-0.011-0.428-0.011c-25.031,0-45.396,20.488-45.396,45.672
c0,11.277,4.093,21.605,10.851,29.582c-10.597,4.133-19.866,11.385-26.525,20.975c-0.144-0.001-0.286-0.011-0.43-0.011
c-25.031,0-45.396,20.488-45.396,45.672c0,11.31,4.117,21.665,10.911,29.651C15.375,342.225,0,363.289,0,387.891V436
c0,5.522,4.477,10,10,10H501.999 M465.895,304.11c0,14.155-11.392,25.671-25.395,25.671c-14.004,0-25.397-11.516-25.397-25.671
s11.393-25.672,25.397-25.672C454.503,278.439,465.895,289.955,465.895,304.11z M395.103,304.11c0,11.31,4.117,21.665,10.911,29.651
c-11.037,4.316-20.448,11.9-27.015,21.574c-6.566-9.674-15.978-17.258-27.015-21.574c6.793-7.986,10.91-18.341,10.91-29.651
c0-17.234-9.54-32.266-23.584-40.041c6.92-6.64,16.14-10.506,25.925-10.506h27.526c9.785,0,19.006,3.866,25.925,10.506
C404.645,271.845,395.103,286.876,395.103,304.11z M256,355.336c-6.567-9.674-15.979-17.259-27.016-21.574
c6.793-7.986,10.91-18.341,10.91-29.651c0-17.234-9.539-32.266-23.583-40.04c6.92-6.641,16.14-10.507,25.925-10.507h27.526
c9.785,0,19.005,3.866,25.925,10.507c-14.044,7.774-23.584,22.806-23.584,40.04c0,11.31,4.117,21.665,10.911,29.651
C271.977,338.078,262.566,345.662,256,355.336z M169.103,304.11c0-14.155,11.393-25.672,25.397-25.672
c14.002,0,25.394,11.517,25.394,25.672s-11.392,25.671-25.394,25.671C180.497,329.781,169.103,318.266,169.103,304.11z M256,182.221
c14.003,0,25.395,11.517,25.395,25.672S270.002,233.564,256,233.564c-14.003,0-25.396-11.516-25.396-25.671
C230.604,193.737,241.997,182.221,256,182.221z M292.103,304.11c0-14.155,11.393-25.672,25.397-25.672
c14.003,0,25.396,11.517,25.396,25.672s-11.393,25.671-25.396,25.671C303.496,329.781,292.103,318.266,292.103,304.11z
M404.396,207.893c0,14.155-11.393,25.671-25.396,25.671s-25.396-11.516-25.396-25.671s11.393-25.672,25.396-25.672
S404.396,193.737,404.396,207.893z M317.5,86c14.003,0,25.396,11.516,25.396,25.671s-11.393,25.672-25.396,25.672
s-25.396-11.517-25.396-25.672S303.497,86,317.5,86z M303.736,157.343h27.526c9.786,0,19.007,3.867,25.927,10.508
c-14.044,7.774-23.585,22.807-23.585,40.042c0,11.277,4.093,21.605,10.851,29.582c-10.598,4.133-19.865,11.385-26.524,20.975
c-0.144-0.001-0.286-0.011-0.431-0.011s-0.287,0.01-0.432,0.011c-6.659-9.589-15.927-16.842-26.524-20.975
c6.758-7.977,10.851-18.305,10.851-29.582c0-17.235-9.541-32.268-23.586-40.042C284.729,161.21,293.95,157.343,303.736,157.343z
M194.5,86c14.002,0,25.394,11.516,25.394,25.671s-11.392,25.672-25.394,25.672c-14.003,0-25.397-11.517-25.397-25.672
S180.497,86,194.5,86z M180.736,157.343h27.526c9.786,0,19.007,3.867,25.927,10.509c-14.045,7.773-23.585,22.806-23.585,40.041
c0,11.277,4.093,21.605,10.851,29.582c-10.597,4.133-19.866,11.385-26.525,20.975c-0.144-0.001-0.286-0.011-0.43-0.011
c-0.145,0-0.286,0.01-0.43,0.011c-6.659-9.59-15.928-16.842-26.525-20.975c6.758-7.977,10.851-18.305,10.851-29.582
c0-17.235-9.541-32.268-23.585-40.042C161.729,161.21,170.951,157.343,180.736,157.343z M133,182.221
c14.003,0,25.395,11.517,25.395,25.672S147.002,233.564,133,233.564c-14.003,0-25.396-11.516-25.396-25.671
C107.604,193.737,118.997,182.221,133,182.221z M119.236,253.564h27.526c9.786,0,19.006,3.866,25.925,10.506
c-14.044,7.774-23.585,22.807-23.585,40.041c0,11.31,4.117,21.666,10.911,29.651c-11.037,4.316-20.448,11.9-27.015,21.574
c-6.567-9.674-15.978-17.258-27.015-21.574c6.794-7.986,10.911-18.341,10.911-29.651c0-17.234-9.54-32.266-23.584-40.041
C100.231,257.43,109.451,253.564,119.236,253.564z M71.5,278.439c14.003,0,25.395,11.517,25.395,25.672S85.502,329.782,71.5,329.782
c-14.003,0-25.396-11.516-25.396-25.671C46.104,289.955,57.497,278.439,71.5,278.439z M20,408.818h31.035c5.523,0,10-4.477,10-10
c0-5.522-4.477-10-10-10H20v-0.928c0-21.014,17.096-38.109,38.109-38.109H84.89c21.014,0,38.109,17.096,38.109,38.109V426H20
V408.818z M143,387.891c0-21.014,17.096-38.109,38.109-38.109h26.781c21.014,0,38.109,17.096,38.109,38.109V426H143V387.891z
M266,387.891c0-21.014,17.096-38.109,38.108-38.109h26.782c21.014,0,38.109,17.096,38.109,38.109V426H266V387.891z M389,426
v-38.109c0-21.014,17.096-38.109,38.109-38.109h26.781c21.013,0,38.108,17.096,38.108,38.109v0.928h-31.034c-5.522,0-10,4.478-10,10
c0,5.523,4.478,10,10,10h31.034V426H389z"/>
<path d="M80.001,388.82h-0.235c-5.523,0-10,4.478-10,10s4.477,10,10,10h0.235c5.523,0,10-4.478,10-10S85.524,388.82,80.001,388.82z"
/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -81,7 +81,10 @@ affectent notamment les comptages d'absences de tous les bulletins des
</div>
<div class="row">
<h1>Emplois du temps</h1>
<div class="help">ScoDoc peut récupérer les emplois du temps de chaque session.</div>
<div class="help">ScoDoc peut récupérer les emplois du temps de chaque session.
Voir <a href="https://scodoc.org/EmploisDuTemps" class="stdlink"
target="_blank">la documentation</a>.
</div>
<div class="col-md-8">
<div class="config-edt">
{{ wtf.form_field(form.edt_ics_path) }}

View File

@ -16,6 +16,12 @@
{{ form_groups_choice|safe }}
<form id="show_modules_titles_form" method="GET">
<input type="checkbox" name="show_modules_titles" {{
'checked' if show_modules_titles else ''}}
onchange="this.form.submit()"/> noms complets des modules</input>
</form>
<div>
<span id="menu-navi">
<button type="button" class="btn btn-default btn-sm move-today"
@ -38,9 +44,16 @@
</li>
<li>Si vous filtrez par groupe, les évènements dont le groupe n'est pas reconnu seront affichés.
</li>
{% if formsemestre.can_be_edited_by(current_user) %}
<li><a class="stdlink" href="{{
url_for('notes.formsemestre_edt_help_config',
scodoc_dept=g.scodoc_dept, formsemestre_id= formsemestre.id)
}}">Aide à la configuration de l'emploi du temps</a>
{% endif %}
</ul>
</div>
</div>
{% endblock app_content %}
{% block scripts %}
@ -107,7 +120,7 @@ document.addEventListener('DOMContentLoaded', function() {
const calendar = new Calendar(container, options);
fetch(`${SCO_URL}/../api/formsemestre/{{formsemestre.id}}/edt?{{groups_query_args|safe}}`)
fetch(`${SCO_URL}/../api/formsemestre/{{formsemestre.id}}/edt?{{groups_query_args|safe}}&show_modules_titles={{show_modules_titles}}`)
.then(r=>{return r.json()})
.then(events=>{
if (typeof events == 'string') {

View File

@ -0,0 +1,87 @@
{% extends "sco_page.j2" %}
{% block app_content %}
<style>
table#edt2group {
border-collapse: collapse;
margin: 25px 0;
font-size: 0.9em;
font-family: sans-serif;
min-width: 400px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}
table#edt2group thead tr th {
background-color: #009879;
color: #ffffff;
text-align: left;
}
table#edt2group thead tr th,
table#edt2group tbody tr td {
padding: 4px 8px;
}
table#edt2group tbody tr {
border-bottom: 1px solid #dddddd !important;
}
table#edt2group tbody tr:nth-of-type(even) {
background-color: #f3f3f3 !important;
}
table#edt2group tbody tr:last-of-type {
border-bottom: 2px solid #009879 !important;
}
table#edt2group tbody tr.active-row {
font-weight: bold !important;
color: #009879 !important;
}
</style>
<div class="tab-content">
<h2>Aide à la configuration de l'emploi du temps</h2>
<ul>
<li>Nombre d'évènements dans le calendrier ics de ce semestre: {{events_sco|length}}</li>
</ul>
<h3>Identifiants de groupes trouvés dans ce calendrier</h3>
<div class="help">
si vous voyez ici de nombreuses lignes, il est possible que l'expression régulière
d'extraction soit incorrecte (voir configuration globale) ou bien que votre logiciel d'emploi du temps génère de nombreux évènements non associés à un groupe donné.
</div>
<div>Voici ce qui a été extrait de l'emploi du temps par l'expression régulière configurée:
</div>
<ul>
{% for gr in edt_groups_ids %}
<li>{{ gr }}</li>
{% endfor %}
</ul>
<h3>Table de correspondance entre groupes EDT et groupes ScoDoc</h3>
<div class="help">
Si votre logiciel d'emploi du temps utilise des identifiants de groupes différents de ceux de ScoDoc, il faut l'indiquer
{% if formsemestre.can_change_groups(current_user) %}
<a class="stdlink" href="{{ url_for( 'scolar.partition_editor',
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre.id,
edit_partition=1 ) }}
">dans l'éditeur de partitions</a>
{% else %}
dans l'éditeur de partitions (vous n'avez pas l'autorisation de le faire vous même).
{% endif %}
</div>
<table id="edt2group">
<thead>
<tr><th>Groupe EDT</th><th>Groupe ScoDoc</th><th>group_id</th></tr>
</thead>
<tbody>
{% for edt_gr in edt2group %}
<tr><td>{{edt_gr or "*"}}</td>
<td>{{edt2group[edt_gr].group_name or "tous"}}</td>
<td>{{edt2group[edt_gr].id}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock app_content %}

View File

@ -39,9 +39,14 @@ from app.decorators import (
)
from app.forms.formsemestre import change_formation, edit_modimpls_codes_apo
from app.models import Formation, FormSemestre, ScoDocSiteConfig
from app.scodoc import sco_formations, sco_formation_versions
from app.scodoc import sco_groups_view
from app.scodoc import (
sco_edt_cal,
sco_formations,
sco_formation_versions,
sco_groups_view,
)
from app.scodoc.sco_permissions import Permission
from app.scodoc import sco_utils as scu
from app.views import notes_bp as bp
from app.views import ScoData
@ -158,6 +163,7 @@ def formsemestre_edit_modimpls_codes(formsemestre_id: int):
@permission_required(Permission.ScoView)
def formsemestre_edt(formsemestre_id: int):
"""Expérimental: affiche emploi du temps du semestre"""
show_modules_titles = scu.to_bool(request.args.get("show_modules_titles", False))
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
cfg = ScoDocSiteConfig.query.filter_by(name="assi_morning_time").first()
hour_start = cfg.value.split(":")[0].lstrip(" 0") if cfg else "7"
@ -182,4 +188,25 @@ def formsemestre_edt(formsemestre_id: int):
),
groups_query_args=groups_infos.groups_query_args,
sco=ScoData(formsemestre=formsemestre),
show_modules_titles=show_modules_titles,
)
@bp.route("/formsemestre/edt_help_config/<int:formsemestre_id>")
@scodoc
@permission_required(Permission.ScoView)
def formsemestre_edt_help_config(formsemestre_id: int):
"""Page d'aide à la configuration de l'extraction emplois du temps
Affiche les identifiants extraits de l'ics et ceux de ScoDoc.
"""
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
edt2group = sco_edt_cal.formsemestre_retreive_groups_from_edt_id(formsemestre)
events_sco, edt_groups_ids = sco_edt_cal.load_and_convert_ics(formsemestre)
return render_template(
"formsemestre/edt_help_config.j2",
formsemestre=formsemestre,
edt2group=edt2group,
edt_groups_ids=edt_groups_ids,
events_sco=events_sco,
sco=ScoData(formsemestre=formsemestre),
)