From b6211c80a6948ed00b3fb9f186e0bc6d6e47cee3 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 23 Sep 2024 14:28:32 +0200 Subject: [PATCH] Fix bilan_ues (UEs sans semestre_idx) --- app/but/validations_view.py | 3 ++- app/tables/bilan_ues.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/but/validations_view.py b/app/but/validations_view.py index 94c02c10f..713d4e137 100644 --- a/app/but/validations_view.py +++ b/app/but/validations_view.py @@ -95,9 +95,10 @@ def get_ue_validation_by_niveau( validation.ue.id} pas de niveau de competence""" ) continue + semestre_idx = validation.ue.guess_semestre_idx() key = ( validation.ue.niveau_competence.id, - "impair" if validation.ue.semestre_idx % 2 else "pair", + "impair" if semestre_idx % 2 else "pair", ) existing = ue_validation_by_niveau.get(key, None) if (not existing) or ( diff --git a/app/tables/bilan_ues.py b/app/tables/bilan_ues.py index ac73c8d67..ee10aa7a2 100644 --- a/app/tables/bilan_ues.py +++ b/app/tables/bilan_ues.py @@ -168,6 +168,7 @@ class RowEtudWithUEs(RowEtudWithInfos): return best_validation = _best_validation(validations) moy_ue = best_validation.moy_ue + ue_semestre_idx = best_validation.ue.guess_semestre_idx() note_class = "" if moy_ue is None: moy_ue = scu.NO_NOTE_STR @@ -181,10 +182,10 @@ class RowEtudWithUEs(RowEtudWithInfos): raw_content=moy_ue, classes=[note_class], column_classes={"note_ue"}, - group=f"col_s{best_validation.ue.semestre_idx}", + group=f"col_s{ue_semestre_idx}", ) if self.table.is_apc: - class_cursus = f"cursus_BUT{(best_validation.ue.semestre_idx+1)//2}" + class_cursus = f"cursus_BUT{(ue_semestre_idx+1)//2}" else: class_cursus = "" self.add_cell( @@ -192,5 +193,5 @@ class RowEtudWithUEs(RowEtudWithInfos): self.table.ue_titles[key], best_validation.code, column_classes={"code_ue", class_cursus}, - group=f"col_s{best_validation.ue.semestre_idx}", + group=f"col_s{ue_semestre_idx}", )