Recap BUT: liens bulletins + popup etud

This commit is contained in:
Emmanuel Viennet 2022-03-27 10:49:45 +02:00
parent 5a71c406fb
commit 2a429a82f0
4 changed files with 37 additions and 7 deletions

View File

@ -10,6 +10,8 @@ import time
import numpy as np
import pandas as pd
from flask import g, url_for
from app import log
from app.comp import moy_ue, moy_sem, inscr_mod
from app.comp.res_common import NotesTableCompat
@ -235,6 +237,15 @@ class ResultatsSemestreBUT(NotesTableCompat):
add_cell(row, "nom_disp", "Nom", etud.nom_disp(), "identite_detail")
add_cell(row, "prenom", "Prénom", etud.prenom, "identite_detail")
add_cell(row, "nom_short", "Nom", etud.nom_short, "identite_court")
row["_nom_short_target"] = url_for(
"notes.formsemestre_bulletinetud",
scodoc_dept=g.scodoc_dept,
formsemestre_id=self.formsemestre.id,
etudid=etudid,
)
row[f"_nom_short_target_attrs"] = f'class="etudinfo" id="{etudid}"'
row["_nom_disp_target"] = row["_nom_short_target"]
row["_nom_disp_target_attrs"] = row["_nom_short_target_attrs"]
self._recap_etud_groups_infos(etudid, row, titles)
# --- Moyenne générale
moy_gen = self.etud_moy_gen.get(etudid, False)

View File

@ -361,12 +361,15 @@ def make_etud_args(
vals = request.args
else:
vals = {}
if "etudid" in vals:
args = {"etudid": int(vals["etudid"])}
elif "code_nip" in vals:
args = {"code_nip": str(vals["code_nip"])}
elif "code_ine" in vals:
args = {"code_ine": str(vals["code_ine"])}
try:
if "etudid" in vals:
args = {"etudid": int(vals["etudid"])}
elif "code_nip" in vals:
args = {"code_nip": str(vals["code_nip"])}
elif "code_ine" in vals:
args = {"code_ine": str(vals["code_ine"])}
except ValueError:
args = {}
if not args:
if abort_404:
abort(404, "pas d'étudiant sélectionné")

View File

@ -1023,7 +1023,13 @@ def _gen_cell(key: str, row: dict, elt="td"):
order = row.get(f"_{key}_order")
if order:
attrs += f' data-order="{order}"'
return f'<{elt} {attrs}>{row.get(key, "")}</{elt}>'
content = row.get(key, "")
target = row.get(f"_{key}_target")
if content and target: # avec lien
content = (
f'<a href="{target}" {row.get(f"_{key}_target_attrs", "")}>{content}</a>'
)
return f"<{elt} {attrs}>{content}</{elt}>"
def _gen_row(keys: list[str], row, elt="td"):

View File

@ -3258,6 +3258,16 @@ table.table_recap .group {
border-left: 1px dashed rgb(160, 160, 160);
}
table.table_recap a:hover {
color: red;
text-decoration: underline;
}
/* noms des etudiants sur recap complet */
table.table_recap a:link, table.table_recap a:visited {
text-decoration: none;
color: black;
}
table.table_recap tfoot th, table.table_recap thead th {
text-align: left;
padding-left: 10px !important;