Fix bilan_ues (UEs sans semestre_idx)

This commit is contained in:
Emmanuel Viennet 2024-09-23 14:28:32 +02:00
parent 2093a7f312
commit b6211c80a6
2 changed files with 6 additions and 4 deletions

View File

@ -95,9 +95,10 @@ def get_ue_validation_by_niveau(
validation.ue.id} pas de niveau de competence""" validation.ue.id} pas de niveau de competence"""
) )
continue continue
semestre_idx = validation.ue.guess_semestre_idx()
key = ( key = (
validation.ue.niveau_competence.id, validation.ue.niveau_competence.id,
"impair" if validation.ue.semestre_idx % 2 else "pair", "impair" if semestre_idx % 2 else "pair",
) )
existing = ue_validation_by_niveau.get(key, None) existing = ue_validation_by_niveau.get(key, None)
if (not existing) or ( if (not existing) or (

View File

@ -168,6 +168,7 @@ class RowEtudWithUEs(RowEtudWithInfos):
return return
best_validation = _best_validation(validations) best_validation = _best_validation(validations)
moy_ue = best_validation.moy_ue moy_ue = best_validation.moy_ue
ue_semestre_idx = best_validation.ue.guess_semestre_idx()
note_class = "" note_class = ""
if moy_ue is None: if moy_ue is None:
moy_ue = scu.NO_NOTE_STR moy_ue = scu.NO_NOTE_STR
@ -181,10 +182,10 @@ class RowEtudWithUEs(RowEtudWithInfos):
raw_content=moy_ue, raw_content=moy_ue,
classes=[note_class], classes=[note_class],
column_classes={"note_ue"}, column_classes={"note_ue"},
group=f"col_s{best_validation.ue.semestre_idx}", group=f"col_s{ue_semestre_idx}",
) )
if self.table.is_apc: if self.table.is_apc:
class_cursus = f"cursus_BUT{(best_validation.ue.semestre_idx+1)//2}" class_cursus = f"cursus_BUT{(ue_semestre_idx+1)//2}"
else: else:
class_cursus = "" class_cursus = ""
self.add_cell( self.add_cell(
@ -192,5 +193,5 @@ class RowEtudWithUEs(RowEtudWithInfos):
self.table.ue_titles[key], self.table.ue_titles[key],
best_validation.code, best_validation.code,
column_classes={"code_ue", class_cursus}, column_classes={"code_ue", class_cursus},
group=f"col_s{best_validation.ue.semestre_idx}", group=f"col_s{ue_semestre_idx}",
) )