Améliore traitement arguments etud_info_html et ue_table

This commit is contained in:
Emmanuel Viennet 2022-11-03 14:14:30 +01:00
parent 2ba882f3c3
commit 564ecee186
2 changed files with 14 additions and 15 deletions

View File

@ -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)

View File

@ -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 = (
"""<div class="etud_info_div">
bac_abbrev = bac.abbrev()
H = f"""<div class="etud_info_div">
<div class="eid_left">
<div class="eid_nom"><div>%(nomprenom)s</div></div>
<div class="eid_info eid_bac">Bac: <span class="eid_bac">%(bac_abbrev)s</span></div>
<div class="eid_info eid_parcours">%(codeparcours)s</div>
<div class="eid_nom"><div>{etud["nomprenom"]}</div></div>
<div class="eid_info eid_bac">Bac: <span class="eid_bac">{bac_abbrev}</span></div>
<div class="eid_info eid_parcours">{codeparcours}</div>
"""
% 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 += '<div class="eid_info">En <b>S%d</b>: %s</div>' % (sem["semestre_id"], grc)
H += f"""<div class="eid_info">En <b>S{sem["semestre_id"]}</b>: {grc}</div>"""
H += "</div>" # fin partie gauche (eid_left)
if with_photo:
H += '<span class="eid_right">' + photo_html + "</span>"