bul json: options affichage

This commit is contained in:
Emmanuel Viennet 2021-12-05 21:54:04 +01:00
parent 3ba30f6250
commit fd80ee2452

View File

@ -14,6 +14,7 @@ from app.comp import df_cache, moy_ue, moy_mod, inscr_mod
from app.scodoc import sco_utils as scu from app.scodoc import sco_utils as scu
from app.scodoc.sco_cache import ResultatsSemestreBUTCache from app.scodoc.sco_cache import ResultatsSemestreBUTCache
from app.scodoc.sco_exceptions import ScoFormatError from app.scodoc.sco_exceptions import ScoFormatError
from app.scodoc import sco_preferences
from app.scodoc.sco_utils import jsnan from app.scodoc.sco_utils import jsnan
@ -220,5 +221,35 @@ class ResultatsSemestreBUT:
"date_jury": "AAAA-MM-JJ", # XXX TODO "date_jury": "AAAA-MM-JJ", # XXX TODO
"groupes": [], # XXX TODO "groupes": [], # XXX TODO
}, },
"options": bulletin_option_affichage(formsemestre),
} }
return d return d
def bulletin_option_affichage(formsemestre):
"dict avec les options d'affichages (préférences) pour ce semestre"
prefs = sco_preferences.SemPreferences(formsemestre.id)
fields = (
"bul_show_abs",
"bul_show_abs_modules",
"bul_show_ects",
"bul_show_codemodules",
"bul_show_matieres",
"bul_show_all_evals",
"bul_show_rangs",
"bul_show_ue_rangs",
"bul_show_mod_rangs",
"bul_show_moypromo",
"bul_show_minmax",
"bul_show_minmax_mod",
"bul_show_minmax_eval",
"bul_show_coef",
"bul_show_ue_cap_details",
"bul_show_ue_cap_current",
"bul_show_temporary",
"bul_temporary_txt",
"bul_show_uevalid",
"bul_show_date_inscr",
)
# on enlève le "bul_" de la clé:
return {field[4:]: prefs[field] for field in fields}