From e7559b7a78cf6bd0026fb24a61c9d998fd7201c5 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 12 Jan 2023 09:49:05 -0300 Subject: [PATCH] Bulletins BUT json: ajout champs block_moyenne_generale et bgcolor --- app/but/bulletin_but.py | 2 +- app/scodoc/sco_preferences.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 59c34204..d8dbd61c 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -361,7 +361,7 @@ class BulletinBUT: "formsemestre_id": formsemestre.id, "etat_inscription": etat_inscription, "options": sco_preferences.bulletin_option_affichage( - formsemestre.id, self.prefs + formsemestre, self.prefs ), } if not published: diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index a7edb8e7..1a596333 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -2332,7 +2332,9 @@ def doc_preferences(): return "\n".join([" | ".join(x) for x in L]) -def bulletin_option_affichage(formsemestre_id: int, prefs: SemPreferences) -> dict: +def bulletin_option_affichage( + formsemestre: "FormSemestre", prefs: SemPreferences +) -> dict: "dict avec les options d'affichages (préférences) pour ce semestre" fields = ( "bul_show_abs", @@ -2356,4 +2358,8 @@ def bulletin_option_affichage(formsemestre_id: int, prefs: SemPreferences) -> di "bul_show_date_inscr", ) # on enlève le "bul_" de la clé: - return {field[4:]: prefs[field] for field in fields} + fields = {field[4:]: prefs[field] for field in fields} + # Ajoute les réglages du formsemestre qui ne sont pas des préférences: + fields["block_moyenne_generale"] = formsemestre.block_moyenne_generale + fields["bgcolor"] = formsemestre.bul_bgcolor + return fields