From 5fc1800f7063b426ddac53b9ff7d846fd8a7dee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9o=20BARAS=20=28IUT1=20Grenoble=29?= Date: Tue, 27 Feb 2024 19:42:04 +0100 Subject: [PATCH] Option nom des colonnes pour publipostage --- app/forms/pe/pe_sem_recap.py | 6 +++++- app/pe/pe_jury.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/forms/pe/pe_sem_recap.py b/app/forms/pe/pe_sem_recap.py index 4ac04e558..de2dbfd50 100644 --- a/app/forms/pe/pe_sem_recap.py +++ b/app/forms/pe/pe_sem_recap.py @@ -56,6 +56,10 @@ class ParametrageClasseurPE(FlaskForm): # synthese_individuelle_etud = BooleanField( # "Générer (suppose les RCUES)" # ) - + publipostage = BooleanField( + "Nomme les moyennes pour publipostage", + # default=False, + # render_kw={"checked": ""}, + ) submit = SubmitField("Générer les classeurs poursuites d'études") cancel = SubmitField("Annuler", render_kw={"formnovalidate": True}) diff --git a/app/pe/pe_jury.py b/app/pe/pe_jury.py index 5673d2542..3881615b3 100644 --- a/app/pe/pe_jury.py +++ b/app/pe/pe_jury.py @@ -560,7 +560,11 @@ class JuryPE(object): for onglet, df in self.synthese.items(): # Conversion colonnes en multiindex df_final = df.copy() - df_final = convert_colonnes_to_multiindex(df_final) + if ( + "publipostage" not in self.options + or not self.options["publipostage"] + ): + df_final = convert_colonnes_to_multiindex(df_final) # Nom de l'onglet if isinstance(onglet, tuple): (repr, type_moy) = onglet @@ -824,6 +828,7 @@ def get_formsemestres_etudiants(etudiants: pe_etudiant.EtudiantsJuryPE) -> dict: def convert_colonnes_to_multiindex(df): """Convertit les colonnes d'un df pour obtenir des colonnes multiindex""" + df_final = df.copy() colonnes = list(df.columns) colonnes = [tuple(col.split("|")) for col in colonnes] # modifie le nom du semestre par sa descr @@ -838,5 +843,5 @@ def convert_colonnes_to_multiindex(df): col_verbose = col colonnes_verbose.append(col_verbose) - df.columns = pd.MultiIndex.from_tuples(colonnes_verbose) - return df + df_final.columns = pd.MultiIndex.from_tuples(colonnes_verbose) + return df_final