1
0
forked from ScoDoc/ScoDoc

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