From 10148bc7c00911f2757831f7045669fc48cd5df2 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 13 Jan 2023 19:50:24 -0300 Subject: [PATCH] =?UTF-8?q?Affichage=20table=20recap=20BUT=20si=20pas=20de?= =?UTF-8?q?=20moyenne=20g=C3=A9n=C3=A9rale:=20pas=20de=20rangs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/comp/res_common.py | 49 +++++++++++++++++++++----------------- app/models/formsemestre.py | 1 + 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/app/comp/res_common.py b/app/comp/res_common.py index 628db367..c4565179 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -519,10 +519,11 @@ class ResultatsSemestre(ResultatsCache): row, "code_nip", "code_nip", etud.code_nip or "", "codes", idx ) # --- Rang - idx = add_cell( - row, "rang", "Rg", self.etud_moy_gen_ranks[etudid], "rang", idx - ) - row["_rang_order"] = f"{self.etud_moy_gen_ranks_int[etudid]:05d}" + if not self.formsemestre.block_moyenne_generale: + idx = add_cell( + row, "rang", "Rg", self.etud_moy_gen_ranks[etudid], "rang", idx + ) + row["_rang_order"] = f"{self.etud_moy_gen_ranks_int[etudid]:05d}" # --- Identité étudiant idx = add_cell( row, "civilite_str", "Civ.", etud.civilite_str, "identite_detail", idx @@ -548,23 +549,24 @@ class ResultatsSemestre(ResultatsCache): idx = 30 # début des colonnes de notes # --- Moyenne générale - moy_gen = self.etud_moy_gen.get(etudid, False) - note_class = "" - if moy_gen is False: - moy_gen = NO_NOTE - elif isinstance(moy_gen, float) and moy_gen < barre_moy: - note_class = " moy_ue_warning" # en rouge - idx = add_cell( - row, - "moy_gen", - "Moy", - fmt_note(moy_gen), - "col_moy_gen" + note_class, - idx, - ) - titles_bot["_moy_gen_target_attrs"] = ( - 'title="moyenne indicative"' if self.is_apc else "" - ) + if not self.formsemestre.block_moyenne_generale: + moy_gen = self.etud_moy_gen.get(etudid, False) + note_class = "" + if moy_gen is False: + moy_gen = NO_NOTE + elif isinstance(moy_gen, float) and moy_gen < barre_moy: + note_class = " moy_ue_warning" # en rouge + idx = add_cell( + row, + "moy_gen", + "Moy", + fmt_note(moy_gen), + "col_moy_gen" + note_class, + idx, + ) + titles_bot["_moy_gen_target_attrs"] = ( + 'title="moyenne indicative"' if self.is_apc else "" + ) # --- Moyenne d'UE nb_ues_validables, nb_ues_warning = 0, 0 for ue in ues_sans_bonus: @@ -733,7 +735,10 @@ class ResultatsSemestre(ResultatsCache): self._recap_add_admissions(rows, titles) # tri par rang croissant - rows.sort(key=lambda e: e["_rang_order"]) + if not self.formsemestre.block_moyenne_generale: + rows.sort(key=lambda e: e["_rang_order"]) + else: + rows.sort(key=lambda e: e["_ues_validables_order"], reverse=True) # INFOS POUR FOOTER bottom_infos = self._recap_bottom_infos(ues_sans_bonus, modimpl_ids, fmt_note) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 6654d691..55e60cc0 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -80,6 +80,7 @@ class FormSemestre(db.Model): block_moyenne_generale = db.Column( db.Boolean(), nullable=False, default=False, server_default="false" ) + "Si vrai, la moyenne générale indicative BUT n'est pas calculée" # semestres decales (pour gestion jurys): gestion_semestrielle = db.Column( db.Boolean(), nullable=False, default=False, server_default="false"