1
0
forked from ScoDoc/ScoDoc

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)
def formsemestre_page_title(formsemestre_id=None):
"""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
@ -540,15 +541,13 @@ def formsemestre_page_title(formsemestre_id=None):
return ""
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
h = render_template(
return render_template(
"formsemestre_page_title.j2",
formsemestre=formsemestre,
scu=scu,
sem_menu_bar=formsemestre_status_menubar(formsemestre),
)
return h
def fill_formsemestre(sem):
"""Add some useful fields to help display formsemestres"""
@ -768,8 +767,7 @@ def formsemestre_description_table(
caption=title,
html_caption=title,
html_class="table_leftalign formsemestre_description",
base_url="%s?formsemestre_id=%s&with_evals=%s"
% (request.base_url, formsemestre_id, with_evals),
base_url=f"{request.base_url}?formsemestre_id={formsemestre_id}&with_evals={with_evals}",
page_title=title,
html_title=html_sco_header.html_sem_header(
"Description du semestre", with_page_header=False
@ -987,7 +985,7 @@ def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None
""",
]
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:
H.append(f" en {sem.modalite}")
if sem.etapes:
@ -1091,7 +1089,8 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
elif datetime.date.today() > formsemestre.date_fin:
if formsemestre.etat:
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:
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):
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:
@ -1215,6 +1215,11 @@ def formsemestre_tableau_modules(
prev_ue_id = None
for modimpl in modimpls:
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 "")
if mod.is_apc():
coef_descr = ", ".join(
@ -1240,7 +1245,7 @@ def formsemestre_tableau_modules(
prev_ue_id = ue["ue_id"]
titre = ue["titre"]
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(
f"""<tr class="formsemestre_status_ue"><td colspan="4">
<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"""<td class="formsemestre_status_code""><a
href="{url_for('notes.moduleimpl_status',
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl['moduleimpl_id'])}"
title="{mod_descr}" class="stdlink">{mod.code}</a></td>"""
)
H.append(
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>
f"""
<td class="formsemestre_status_code""><a
href="{moduleimpl_status_url}"
title="{mod_descr}" class="stdlink">{mod.code}</a></td>
<td class="scotext"><a href="{moduleimpl_status_url}" title="{mod_descr}"
class="formsemestre_status_link">{mod.abbrev or mod.titre or ""}</a>
</td>
<td class="formsemestre_status_inscrits">{len(mod_inscrits)}</td>
<td class="resp scotext">
<a class="discretelink" href="{
url_for("notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl["moduleimpl_id"]
) }" title="{mod_ens}">{ sco_users.user_info(modimpl["responsable_id"])["prenomnom"] }</a>
<a class="discretelink" href="{moduleimpl_status_url}" title="{mod_ens}">{
sco_users.user_info(modimpl["responsable_id"])["prenomnom"]
}</a>
</td>
<td>
"""
@ -1331,18 +1331,21 @@ def formsemestre_tableau_modules(
)
if nb_evals != 0:
H.append(
'<a href="moduleimpl_status?moduleimpl_id=%s" class="formsemestre_status_link">%s prévues, %s ok</a>'
% (modimpl["moduleimpl_id"], nb_evals, etat["nb_evals_completes"])
f"""<a href="{moduleimpl_status_url}"
class="formsemestre_status_link">{nb_evals} prévues,
{etat["nb_evals_completes"]} ok</a>"""
)
if etat["nb_evals_en_cours"] > 0:
H.append(
', <span><a class="redlink" href="moduleimpl_status?moduleimpl_id=%s" title="Il manque des notes">%s en cours</a></span>'
% (modimpl["moduleimpl_id"], etat["nb_evals_en_cours"])
f""", <span><a class="redlink" href="{moduleimpl_status_url}"
title="Il manque des notes">{
etat["nb_evals_en_cours"]
} en cours</a></span>"""
)
if etat["attente"]:
H.append(
' <span><a class="redlink" href="moduleimpl_status?moduleimpl_id=%s" title="Il y a des notes en attente">[en attente]</a></span>'
% modimpl["moduleimpl_id"]
f""" <span><a class="redlink" href="{moduleimpl_status_url}"
title="Il y a des notes en attente">[en attente]</a></span>"""
)
elif mod.module_type == ModuleType.MALUS:
nb_malus_notes = sum(
@ -1352,10 +1355,10 @@ def formsemestre_tableau_modules(
]
)
H.append(
"""<td class="malus">
<a href="moduleimpl_status?moduleimpl_id=%s" class="formsemestre_status_link">malus (%d notes)</a>
f"""<td class="malus">
<a href="{moduleimpl_status_url}" class="formsemestre_status_link">malus
({nb_malus_notes} notes)</a>
"""
% (modimpl["moduleimpl_id"], nb_malus_notes)
)
else:
raise ValueError(f"Invalid module_type {mod.module_type}") # a bug