From bf8614a3869e1b803ad38f97dcf5280a3abacf16 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 1 Jul 2022 00:15:55 +0200 Subject: [PATCH] Tri PV jury BUT --- app/but/jury_but_pv.py | 17 ++++++++++++----- sco_version.py | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/but/jury_but_pv.py b/app/but/jury_but_pv.py index 1524c0997..13f61cddb 100644 --- a/app/but/jury_but_pv.py +++ b/app/but/jury_but_pv.py @@ -26,11 +26,15 @@ def _descr_cursus_but(etud: Identite) -> str: # prend simplement tous les semestre de type APC, ce qui sera faux si # l'étudiant change de spécialité au sein du même département # (ce qui ne peut normalement pas se produire) - indices = [ - ins.formsemestre.semestre_id - for ins in etud.formsemestre_inscriptions - if ins.formsemestre.formation.is_apc() - ] + indices = sorted( + [ + ins.formsemestre.semestre_id + if ins.formsemestre.semestre_id is not None + else -1 + for ins in etud.formsemestre_inscriptions + if ins.formsemestre.formation.is_apc() + ] + ) return ", ".join(f"S{indice}" for indice in indices) @@ -71,6 +75,7 @@ def pvjury_table_but(formsemestre_id: int, format="html") -> list[dict]: deca = None row = { "nom": etud.etat_civil_pv(line_sep=line_sep), + "_nom_order": etud.sort_key, "cursus": _descr_cursus_but(etud), "niveaux": deca.descr_niveaux_validation(line_sep=line_sep) if deca @@ -81,6 +86,8 @@ def pvjury_table_but(formsemestre_id: int, format="html") -> list[dict]: rows.append(row) + rows.sort(key=lambda x: x["_nom_order"]) + # Style excel... passages à la ligne sur \n xls_style_base = sco_excel.excel_make_style() xls_style_base["alignment"] = Alignment(wrapText=True, vertical="top") diff --git a/sco_version.py b/sco_version.py index 59ff6d537..6cb2218c2 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.3.10" +SCOVERSION = "9.3.11" SCONAME = "ScoDoc"