From 18f4b9cd42d48f49fd0590fae0a960d27b05384d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 3 Nov 2022 14:14:30 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liore=20traitement=20arguments=20etud?= =?UTF-8?q?=5Finfo=5Fhtml=20et=20ue=5Ftable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_edit_ue.py | 2 +- app/scodoc/sco_page_etud.py | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 9d9eadf5..d581bb65 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -643,7 +643,7 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list parcours = formation.get_parcours() is_apc = parcours.APC_SAE locked = formation.has_locked_sems() - if semestre_idx == "all": + if semestre_idx == "all" or semestre_idx == "": semestre_idx = None else: semestre_idx = int(semestre_idx) diff --git a/app/scodoc/sco_page_etud.py b/app/scodoc/sco_page_etud.py index 259bbe33..2bc1cc7a 100644 --- a/app/scodoc/sco_page_etud.py +++ b/app/scodoc/sco_page_etud.py @@ -30,7 +30,7 @@ Fiche description d'un étudiant et de son parcours """ -from flask import url_for, g, request +from flask import abort, url_for, g, request from flask_login import current_user import app.scodoc.sco_utils as scu @@ -582,24 +582,23 @@ def etud_info_html(etudid, with_photo="1", debug=False): """ formsemestre_id = sco_formsemestre_status.retreive_formsemestre_from_request() with_photo = int(with_photo) - etud = sco_etud.get_etud_info(filled=True)[0] + etuds = sco_etud.get_etud_info(filled=True) + if etuds: + etud = etuds[0] + else: + abort(404, "etudiant inconnu") photo_html = sco_photos.etud_photo_html(etud, title="fiche de " + etud["nom"]) # experimental: may be too slow to be here - etud["codeparcours"], etud["decisions_jury"] = sco_report.get_codeparcoursetud( - etud, prefix="S", separator=", " - ) + codeparcours, _ = sco_report.get_codeparcoursetud(etud, prefix="S", separator=", ") bac = sco_bac.Baccalaureat(etud["bac"], etud["specialite"]) - etud["bac_abbrev"] = bac.abbrev() - H = ( - """
+ bac_abbrev = bac.abbrev() + H = f"""
-
%(nomprenom)s
-
Bac: %(bac_abbrev)s
-
%(codeparcours)s
+
{etud["nomprenom"]}
+
Bac: {bac_abbrev}
+
{codeparcours}
""" - % etud - ) # Informations sur l'etudiant dans le semestre courant: sem = None @@ -610,7 +609,7 @@ def etud_info_html(etudid, with_photo="1", debug=False): if sem: groups = sco_groups.get_etud_groups(etudid, formsemestre_id) grc = sco_groups.listgroups_abbrev(groups) - H += '
En S%d: %s
' % (sem["semestre_id"], grc) + H += f"""
En S{sem["semestre_id"]}: {grc}
""" H += "
" # fin partie gauche (eid_left) if with_photo: H += '' + photo_html + ""