diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index d581bb658e..1ce7c347aa 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -653,6 +653,12 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list ues_obj = UniteEns.query.filter_by( formation_id=formation_id, is_external=False ).order_by(UniteEns.semestre_idx, UniteEns.numero) + # safety check: renumérote les ue s'il en manque ou s'il y a des ex-aequo. + # cela facilite le travail de la passerelle ! + numeros = {ue.numero for ue in ues_obj} + if (None in numeros) or len(numeros) < ues_obj.count(): + scu.objects_renumber(db, ues_obj) + ues_externes_obj = UniteEns.query.filter_by( formation_id=formation_id, is_external=True )