From b1ea0080e0ca2294f995fef4b29cc91468aa11cc Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 18 Oct 2023 17:53:42 +0200 Subject: [PATCH] Bulletin BUT court: affichage des ECTS. Fixes #776 --- app/but/bulletin_but_court.py | 1 + app/but/bulletin_but_court_pdf.py | 21 +++++++++++++++------ app/templates/but/bulletin_court_page.j2 | 21 +++++++++++++-------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/but/bulletin_but_court.py b/app/but/bulletin_but_court.py index 2c326177c..a4b5dabd0 100644 --- a/app/but/bulletin_but_court.py +++ b/app/but/bulletin_but_court.py @@ -97,6 +97,7 @@ def bulletin_but(formsemestre_id: int, etudid: int = None, fmt="html"): "etud": etud, "formsemestre": formsemestre, "logo": logo, + "prefs": bulletins_sem.prefs, "title": f"Bul. {etud.nom_disp()} BUT (court)", "ue_validation_by_niveau": ue_validation_by_niveau, "ues_acronyms": [ diff --git a/app/but/bulletin_but_court_pdf.py b/app/but/bulletin_but_court_pdf.py index 9446d8479..f1fd112ad 100644 --- a/app/but/bulletin_but_court_pdf.py +++ b/app/but/bulletin_but_court_pdf.py @@ -30,6 +30,7 @@ from app.models import ( from app.scodoc.sco_bulletins_standard import BulletinGeneratorStandard from app.scodoc.sco_logos import Logo from app.scodoc.sco_pdf import PDFLOCK, SU +from app.scodoc.sco_preferences import SemPreferences def make_bulletin_but_court_pdf( @@ -40,6 +41,7 @@ def make_bulletin_but_court_pdf( etud: Identite = None, formsemestre: FormSemestre = None, logo: Logo = None, + prefs: SemPreferences = None, title: str = "", ue_validation_by_niveau: dict[tuple[int, str], ScolarFormSemestreValidation] = None, ues_acronyms: list[str] = None, @@ -79,6 +81,7 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard): etud: Identite = None, formsemestre: FormSemestre = None, logo: Logo = None, + prefs: SemPreferences = None, title: str = "", ue_validation_by_niveau: dict[ tuple[int, str], ScolarFormSemestreValidation @@ -93,6 +96,7 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard): self.etud = etud self.formsemestre = formsemestre self.logo = logo + self.prefs = prefs self.title = title self.ue_validation_by_niveau = ue_validation_by_niveau self.ues_acronyms = ues_acronyms # sans UEs sport @@ -274,16 +278,21 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard): f'{bul["ues"][ue]["moyenne"]["rang"]} / {bul["ues"][ue]["moyenne"]["total"]}' for ue in self.ues_acronyms ], - ["ECTS"] - + [ - f'{self.decision_ues[ue]["ects"]:g}' if ue in self.decision_ues else "" - for ue in self.ues_acronyms - ], + ] + if self.prefs["bul_show_ects"]: + rows += [ + ["ECTS"] + + [ + f'{bul["ues"][ue]["ECTS"]["acquis"]:g} /{bul["ues"][ue]["ECTS"]["total"]:g}' + for ue in self.ues_acronyms + ] + ] + rows += [ ["Jury"] + [ self.decision_ues[ue]["code"] if ue in self.decision_ues else "" for ue in self.ues_acronyms - ], + ] ] blue_bg = Color(183 / 255.0, 235 / 255.0, 255 / 255.0) table_style = [ diff --git a/app/templates/but/bulletin_court_page.j2 b/app/templates/but/bulletin_court_page.j2 index 730ba2b89..8f7aa446d 100644 --- a/app/templates/but/bulletin_court_page.j2 +++ b/app/templates/but/bulletin_court_page.j2 @@ -91,14 +91,19 @@ {{bul.ues[ue].moyenne.rang}} / {{bul.ues[ue].moyenne.total}} {% endfor %} - - ECTS - {% for ue in ues_acronyms %} - {{ - "%g"|format(decision_ues[ue].ects) if ue in decision_ues else "" - }} - {% endfor %} - + {% if prefs["bul_show_ects"] %} + + ECTS + {% for ue in ues_acronyms %} + {{ + "%g"|format(bul["ues"][ue]["ECTS"]["acquis"]) if ue in bul["ues"] else "" + }} / {{ + "%g"|format(bul["ues"][ue]["ECTS"]["total"]) if ue in bul["ues"] else "" + }} + + {% endfor %} + + {% endif %} Jury {% for ue in ues_acronyms %}