UE colors

This commit is contained in:
Emmanuel Viennet 2022-02-10 23:14:33 +01:00
parent 49a07e7704
commit 5834ea5cb7

View File

@ -575,7 +575,9 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list
semestre_ids = range(1, parcours.NB_SEM + 1)
# transition: on requete ici via l'ORM mais on utilise les fonctions ScoDoc7
# basées sur des dicts
ues_obj = UniteEns.query.filter_by(formation_id=formation_id, is_external=False)
ues_obj = UniteEns.query.filter_by(
formation_id=formation_id, is_external=False
).order_by(UniteEns.semestre_idx, UniteEns.numero)
ues_externes_obj = UniteEns.query.filter_by(
formation_id=formation_id, is_external=True
)
@ -1415,15 +1417,15 @@ def ue_list_semestre_ids(ue: dict):
UE_PALETTE = [
"#EFA00B",
"#99C24D",
"#EC9192",
"#0075C4",
"#D65108",
"#DEC0F1",
"#B02E0C",
"#151E3F",
"#FB3640",
"#B80004", # rouge
"#F97B3D", # Orange Crayola
"#FEB40B", # Honey Yellow
"#80CB3F", # Yellow Green
"#05162E", # Oxford Blue
"#548687", # Steel Teal
"#444054", # Independence
"#889696", # Spanish Gray
"#0CA4A5", # Viridian Green
]
@ -1436,8 +1438,8 @@ def colorie_anciennes_ues(ues: list[UniteEns]) -> None:
last_sem_idx = 0
for ue in ues:
if ue.semestre_idx != last_sem_idx:
last_sem_idx = ue.semestre_idx
index = 0
last_sem_idx = ue.semestre_idx
if ue.color is None:
ue.color = UE_PALETTE[index % nb_colors]
index += 1