From f183cc3c272f5fc9c4a865efb86fe7f9f713cff6 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 18 Sep 2022 21:58:38 +0200 Subject: [PATCH] Bul. BUT PDF: rang dans les UE, cache bonus/malus quand ils sont nuls --- app/but/bulletin_but_pdf.py | 30 +++++++++++++----------------- app/scodoc/sco_preferences.py | 2 ++ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/but/bulletin_but_pdf.py b/app/but/bulletin_but_pdf.py index 3954c818f..94e5b588a 100644 --- a/app/but/bulletin_but_pdf.py +++ b/app/but/bulletin_but_pdf.py @@ -80,8 +80,6 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard): "coef": 2 * cm, } title_bg = tuple(x / 255.0 for x in title_bg) - nota_bene = """La moyenne des ressources et SAÉs dans une UE - dépend des poids donnés aux évaluations.""" # elems pour générer table avec gen_table (liste de dicts) rows = [ # Ligne de titres @@ -92,17 +90,6 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard): "_coef_pdf": Paragraph("Coef."), "_css_row_class": "note_bold", "_pdf_row_markup": ["b"], - "_pdf_style": [ - ("BACKGROUND", (0, 0), (-1, 0), title_bg), - # ("BOTTOMPADDING", (0, 0), (-1, 0), 7), - ], - }, - { - "titre": nota_bene, - "_titre_pdf": Paragraph( - f"{nota_bene}" - ), - "_titre_colspan": 3, "_pdf_style": [ ("BACKGROUND", (0, 0), (-1, 0), title_bg), ("BOTTOMPADDING", (0, 0), (-1, 0), 7), @@ -167,17 +154,26 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard): ects_txt = f'ECTS: {ue["ECTS"]["acquis"]:.3g} / {ue["ECTS"]["total"]:.3g}' else: ects_txt = "" + # case Bonus/Malus/Rang "bmr" + fields_bmr = [] + if float(ue["bonus"]) != 0: + fields_bmr.append(f"Bonus: {ue['bonus']}") + if float(ue["malus"]) != 0: + fields_bmr.append(f"Malus: {ue['malus']}") + if self.preferences["bul_show_ue_rangs"]: + fields_bmr.append( + f"Rang: {ue['moyenne']['rang']} / {ue['moyenne']['total']}" + ) t = { - "titre": f"""Bonus: {ue['bonus']} - Malus: { - ue["malus"]}""", + "titre": " - ".join(fields_bmr), "coef": ects_txt, "_coef_pdf": Paragraph(f"""{ects_txt}"""), "_coef_colspan": 2, "_pdf_style": [ ("BACKGROUND", (0, 0), (-1, 0), title_bg), ("LINEBELOW", (0, 0), (-1, 0), self.PDF_LINEWIDTH, self.PDF_LINECOLOR), - # cadre autour du bonus/malus, gris clair - ("BOX", (0, 0), (0, 0), self.PDF_LINEWIDTH, (0.7, 0.7, 0.7)), + # ligne au dessus du bonus/malus, gris clair + ("LINEABOVE", (0, 0), (-1, 0), self.PDF_LINEWIDTH, (0.7, 0.7, 0.7)), ], } rows.append(t) diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index 5a35c2678..a06ffb978 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -1218,6 +1218,7 @@ class BasePreferences(object): { "initvalue": 0, "title": "Afficher les matières sur les bulletins", + "explanation": "(sans effet en BUT)", "input_type": "boolcheckbox", "category": "bul", "labels": ["non", "oui"], @@ -1259,6 +1260,7 @@ class BasePreferences(object): { "initvalue": 1, "title": "Afficher le classement dans chaque module sur les bulletins", + "explanation": "(sans effet en BUT)", "input_type": "boolcheckbox", "category": "bul", "labels": ["non", "oui"],