From 2a429a82f04e6d5501b1f43c2549d37d8647db49 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 27 Mar 2022 10:49:45 +0200 Subject: [PATCH] Recap BUT: liens bulletins + popup etud --- app/comp/res_but.py | 11 +++++++++++ app/models/etudiants.py | 15 +++++++++------ app/scodoc/sco_recapcomplet.py | 8 +++++++- app/static/css/scodoc.css | 10 ++++++++++ 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/app/comp/res_but.py b/app/comp/res_but.py index 6c19c49fe..ba4bec615 100644 --- a/app/comp/res_but.py +++ b/app/comp/res_but.py @@ -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) diff --git a/app/models/etudiants.py b/app/models/etudiants.py index c3136721e..b1a49e5c2 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -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é") diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index 3519d73d6..7f939b367 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -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, "")}' + content = row.get(key, "") + target = row.get(f"_{key}_target") + if content and target: # avec lien + content = ( + f'{content}' + ) + return f"<{elt} {attrs}>{content}" def _gen_row(keys: list[str], row, elt="td"): diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index d73104643..8884e9a51 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -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;