Bulletins BUT json: ajout champs block_moyenne_generale et bgcolor

This commit is contained in:
Emmanuel Viennet 2023-01-12 09:49:05 -03:00
parent 68ac2195c9
commit 79bdf03caa
2 changed files with 9 additions and 3 deletions

View File

@ -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:

View File

@ -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