diff --git a/app/but/bulletin_but_pdf.py b/app/but/bulletin_but_pdf.py index 94e5b588a0..481ac41509 100644 --- a/app/but/bulletin_but_pdf.py +++ b/app/but/bulletin_but_pdf.py @@ -76,15 +76,34 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard): """ col_widths = { "titre": None, + "min": 1.5 * cm, + "moy": 1.5 * cm, + "max": 1.5 * cm, "moyenne": 2 * cm, "coef": 2 * cm, } + with_col_minmax = self.preferences["bul_show_minmax"] + with_col_moypromo = self.preferences["bul_show_moypromo"] + # Noms des colonnes à afficher: + col_keys = ["titre"] + if with_col_minmax: + col_keys += ["min"] + if with_col_moypromo: + col_keys += ["moy"] + if with_col_minmax: + col_keys += ["max"] + col_keys += ["coef", "moyenne"] + # Couleur fond: title_bg = tuple(x / 255.0 for x in title_bg) # elems pour générer table avec gen_table (liste de dicts) rows = [ # Ligne de titres { "titre": "Unités d'enseignement", + "min": "Promotion", + "moy": "", + "max": "", + "_min_colspan": 2, "moyenne": Paragraph("Note/20"), "coef": "Coef.", "_coef_pdf": Paragraph("Coef."), @@ -92,20 +111,40 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard): "_pdf_row_markup": ["b"], "_pdf_style": [ ("BACKGROUND", (0, 0), (-1, 0), title_bg), - ("BOTTOMPADDING", (0, 0), (-1, 0), 7), - ( - "LINEBELOW", - (0, 0), - (-1, 0), - self.PDF_LINEWIDTH, - blue, - ), ], }, ] - col_keys = ["titre", "coef", "moyenne"] # noms des colonnes à afficher + if with_col_moypromo and not with_col_minmax: + rows[-1]["moy"] = "Promotion" + # 2eme ligne titres si nécessaire + if with_col_minmax: # TODO or with_col_abs: + rows.append( + { + "min": "min.", + "moy": "moy.", + "max": "max.", + # "abs": "(Tot. / J.)", + "_css_row_class": "note_bold", + "_pdf_row_markup": ["b"], + "_pdf_style": [ + ("BACKGROUND", (0, 0), (-1, 0), title_bg), + ], + } + ) + rows[-1]["_pdf_style"] += [ + ("BOTTOMPADDING", (0, 0), (-1, 0), 7), + ( + "LINEBELOW", + (0, 0), + (-1, 0), + self.PDF_LINEWIDTH, + blue, + ), + ] + for ue_acronym, ue in self.infos["ues"].items(): self.ue_rows(rows, ue_acronym, ue, title_bg) + # Global pdf style commands: pdf_style = [ ("VALIGN", (0, 0), (-1, -1), "TOP"), @@ -175,6 +214,9 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard): # ligne au dessus du bonus/malus, gris clair ("LINEABOVE", (0, 0), (-1, 0), self.PDF_LINEWIDTH, (0.7, 0.7, 0.7)), ], + "min": ue["moyenne"]["min"], + "max": ue["moyenne"]["max"], + "moy": ue["moyenne"]["moy"], } rows.append(t) diff --git a/app/scodoc/sco_bulletins_standard.py b/app/scodoc/sco_bulletins_standard.py index e1e8537201..45765eb29e 100644 --- a/app/scodoc/sco_bulletins_standard.py +++ b/app/scodoc/sco_bulletins_standard.py @@ -362,9 +362,9 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator): # 2eme ligne titres si nécessaire if with_col_minmax or with_col_abs: t = { - "min": "mini", + "min": "min.", "moy": "moy.", - "max": "maxi", + "max": "max.", "abs": "(Tot. / J.)", "_css_row_class": "note_bold", "_pdf_row_markup": ["b"],