1
0
forked from ScoDoc/ScoDoc

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 committed by iziram
parent d8a98b6e5b
commit e7559b7a78
2 changed files with 9 additions and 3 deletions

View File

@ -361,7 +361,7 @@ class BulletinBUT:
"formsemestre_id": formsemestre.id, "formsemestre_id": formsemestre.id,
"etat_inscription": etat_inscription, "etat_inscription": etat_inscription,
"options": sco_preferences.bulletin_option_affichage( "options": sco_preferences.bulletin_option_affichage(
formsemestre.id, self.prefs formsemestre, self.prefs
), ),
} }
if not published: if not published:

View File

@ -2332,7 +2332,9 @@ def doc_preferences():
return "\n".join([" | ".join(x) for x in L]) 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" "dict avec les options d'affichages (préférences) pour ce semestre"
fields = ( fields = (
"bul_show_abs", "bul_show_abs",
@ -2356,4 +2358,8 @@ def bulletin_option_affichage(formsemestre_id: int, prefs: SemPreferences) -> di
"bul_show_date_inscr", "bul_show_date_inscr",
) )
# on enlève le "bul_" de la clé: # 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