Modif message tableau bord sem.

This commit is contained in:
Emmanuel Viennet 2023-02-02 06:40:58 -03:00 committed by iziram
parent e81ad610b6
commit be367de2a1

View File

@ -523,7 +523,8 @@ def retreive_formsemestre_from_request() -> int:
# Element HTML decrivant un semestre (barre de menu et infos) # Element HTML decrivant un semestre (barre de menu et infos)
def formsemestre_page_title(formsemestre_id=None): def formsemestre_page_title(formsemestre_id=None):
"""Element HTML decrivant un semestre (barre de menu et infos) """Element HTML decrivant un semestre (barre de menu et infos)
Cherche dans la requete si un semestre est défini (formsemestre_id ou moduleimpl ou evaluation ou group) Cherche dans la requete si un semestre est défini
via (formsemestre_id ou moduleimpl ou evaluation ou group)
""" """
formsemestre_id = ( formsemestre_id = (
formsemestre_id formsemestre_id
@ -540,15 +541,13 @@ def formsemestre_page_title(formsemestre_id=None):
return "" return ""
formsemestre = FormSemestre.query.get_or_404(formsemestre_id) formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
h = render_template( return render_template(
"formsemestre_page_title.j2", "formsemestre_page_title.j2",
formsemestre=formsemestre, formsemestre=formsemestre,
scu=scu, scu=scu,
sem_menu_bar=formsemestre_status_menubar(formsemestre), sem_menu_bar=formsemestre_status_menubar(formsemestre),
) )
return h
def fill_formsemestre(sem): def fill_formsemestre(sem):
"""Add some useful fields to help display formsemestres""" """Add some useful fields to help display formsemestres"""
@ -768,8 +767,7 @@ def formsemestre_description_table(
caption=title, caption=title,
html_caption=title, html_caption=title,
html_class="table_leftalign formsemestre_description", html_class="table_leftalign formsemestre_description",
base_url="%s?formsemestre_id=%s&with_evals=%s" base_url=f"{request.base_url}?formsemestre_id={formsemestre_id}&with_evals={with_evals}",
% (request.base_url, formsemestre_id, with_evals),
page_title=title, page_title=title,
html_title=html_sco_header.html_sem_header( html_title=html_sco_header.html_sem_header(
"Description du semestre", with_page_header=False "Description du semestre", with_page_header=False
@ -923,7 +921,7 @@ def _make_listes_sem(formsemestre: FormSemestre, with_absences=True):
f"""<h4><a f"""<h4><a
href="{ href="{
url_for("scolar.edit_partition_form", url_for("scolar.edit_partition_form",
formsemestre_id=formsemestre.id, formsemestre_id=formsemestre.id,
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
) )
}">Ajouter une partition</a></h4>""" }">Ajouter une partition</a></h4>"""
@ -980,14 +978,14 @@ def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None
), ),
f"""<table> f"""<table>
<tr><td class="fichetitre2">Formation: </td><td> <tr><td class="fichetitre2">Formation: </td><td>
<a href="{url_for('notes.ue_table', <a href="{url_for('notes.ue_table',
scodoc_dept=g.scodoc_dept, formation_id=sem.formation.id)}" scodoc_dept=g.scodoc_dept, formation_id=sem.formation.id)}"
class="discretelink" title="Formation { class="discretelink" title="Formation {
formation.acronyme}, v{formation.version}">{formation.titre}</a> formation.acronyme}, v{formation.version}">{formation.titre}</a>
""", """,
] ]
if sem.semestre_id >= 0: if sem.semestre_id >= 0:
H.append(", %s %s" % (parcours.SESSION_NAME, sem.semestre_id)) H.append(f", {parcours.SESSION_NAME} {sem.semestre_id}")
if sem.modalite: if sem.modalite:
H.append(f"&nbsp;en {sem.modalite}") H.append(f"&nbsp;en {sem.modalite}")
if sem.etapes: if sem.etapes:
@ -1091,7 +1089,8 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
elif datetime.date.today() > formsemestre.date_fin: elif datetime.date.today() > formsemestre.date_fin:
if formsemestre.etat: if formsemestre.etat:
H.append( H.append(
"""<span class="formsemestre_status_warning">semestre du passé non verrouillé</span>""" """<span
class="formsemestre_status_warning">semestre terminé mais non verrouillé</span>"""
) )
else: else:
H.append( H.append(
@ -1101,7 +1100,8 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
if sco_preferences.get_preference("bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference("bul_show_all_evals", formsemestre_id):
H.append( H.append(
"""<div class="formsemestre_status_warning">Toutes évaluations (même incomplètes) visibles</div>""" """<div class="formsemestre_status_warning"
>Toutes évaluations (même incomplètes) visibles</div>"""
) )
if nt.expr_diagnostics: if nt.expr_diagnostics:
@ -1215,6 +1215,11 @@ def formsemestre_tableau_modules(
prev_ue_id = None prev_ue_id = None
for modimpl in modimpls: for modimpl in modimpls:
mod: Module = Module.query.get(modimpl["module_id"]) mod: Module = Module.query.get(modimpl["module_id"])
moduleimpl_status_url = url_for(
"notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept,
moduleimpl_id=modimpl["moduleimpl_id"],
)
mod_descr = "Module " + (mod.titre or "") mod_descr = "Module " + (mod.titre or "")
if mod.is_apc(): if mod.is_apc():
coef_descr = ", ".join( coef_descr = ", ".join(
@ -1240,7 +1245,7 @@ def formsemestre_tableau_modules(
prev_ue_id = ue["ue_id"] prev_ue_id = ue["ue_id"]
titre = ue["titre"] titre = ue["titre"]
if use_ue_coefs: if use_ue_coefs:
titre += " <b>(coef. %s)</b>" % (ue["coefficient"] or 0.0) titre += f""" <b>(coef. {ue["coefficient"] or 0.0})</b>"""
H.append( H.append(
f"""<tr class="formsemestre_status_ue"><td colspan="4"> f"""<tr class="formsemestre_status_ue"><td colspan="4">
<span class="status_ue_acro">{ue["acronyme"]}</span> <span class="status_ue_acro">{ue["acronyme"]}</span>
@ -1280,23 +1285,18 @@ def formsemestre_tableau_modules(
H.append(f'<tr class="formsemestre_status{fontorange}">') H.append(f'<tr class="formsemestre_status{fontorange}">')
H.append( H.append(
f"""<td class="formsemestre_status_code""><a f"""
href="{url_for('notes.moduleimpl_status', <td class="formsemestre_status_code""><a
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl['moduleimpl_id'])}" href="{moduleimpl_status_url}"
title="{mod_descr}" class="stdlink">{mod.code}</a></td>""" title="{mod_descr}" class="stdlink">{mod.code}</a></td>
) <td class="scotext"><a href="{moduleimpl_status_url}" title="{mod_descr}"
H.append( class="formsemestre_status_link">{mod.abbrev or mod.titre or ""}</a>
f"""<td class="scotext"><a href="{
url_for( "notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl["moduleimpl_id"]
) }" title="{mod_descr}" class="formsemestre_status_link">{mod.abbrev or mod.titre or ""}</a>
</td> </td>
<td class="formsemestre_status_inscrits">{len(mod_inscrits)}</td> <td class="formsemestre_status_inscrits">{len(mod_inscrits)}</td>
<td class="resp scotext"> <td class="resp scotext">
<a class="discretelink" href="{ <a class="discretelink" href="{moduleimpl_status_url}" title="{mod_ens}">{
url_for("notes.moduleimpl_status", sco_users.user_info(modimpl["responsable_id"])["prenomnom"]
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl["moduleimpl_id"] }</a>
) }" title="{mod_ens}">{ sco_users.user_info(modimpl["responsable_id"])["prenomnom"] }</a>
</td> </td>
<td> <td>
""" """
@ -1331,18 +1331,21 @@ def formsemestre_tableau_modules(
) )
if nb_evals != 0: if nb_evals != 0:
H.append( H.append(
'<a href="moduleimpl_status?moduleimpl_id=%s" class="formsemestre_status_link">%s prévues, %s ok</a>' f"""<a href="{moduleimpl_status_url}"
% (modimpl["moduleimpl_id"], nb_evals, etat["nb_evals_completes"]) class="formsemestre_status_link">{nb_evals} prévues,
{etat["nb_evals_completes"]} ok</a>"""
) )
if etat["nb_evals_en_cours"] > 0: if etat["nb_evals_en_cours"] > 0:
H.append( H.append(
', <span><a class="redlink" href="moduleimpl_status?moduleimpl_id=%s" title="Il manque des notes">%s en cours</a></span>' f""", <span><a class="redlink" href="{moduleimpl_status_url}"
% (modimpl["moduleimpl_id"], etat["nb_evals_en_cours"]) title="Il manque des notes">{
etat["nb_evals_en_cours"]
} en cours</a></span>"""
) )
if etat["attente"]: if etat["attente"]:
H.append( H.append(
' <span><a class="redlink" href="moduleimpl_status?moduleimpl_id=%s" title="Il y a des notes en attente">[en attente]</a></span>' f""" <span><a class="redlink" href="{moduleimpl_status_url}"
% modimpl["moduleimpl_id"] title="Il y a des notes en attente">[en attente]</a></span>"""
) )
elif mod.module_type == ModuleType.MALUS: elif mod.module_type == ModuleType.MALUS:
nb_malus_notes = sum( nb_malus_notes = sum(
@ -1352,10 +1355,10 @@ def formsemestre_tableau_modules(
] ]
) )
H.append( H.append(
"""<td class="malus"> f"""<td class="malus">
<a href="moduleimpl_status?moduleimpl_id=%s" class="formsemestre_status_link">malus (%d notes)</a> <a href="{moduleimpl_status_url}" class="formsemestre_status_link">malus
({nb_malus_notes} notes)</a>
""" """
% (modimpl["moduleimpl_id"], nb_malus_notes)
) )
else: else:
raise ValueError(f"Invalid module_type {mod.module_type}") # a bug raise ValueError(f"Invalid module_type {mod.module_type}") # a bug