From aca96b7c491d424e20d9e1f549deefb82a44f98f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 3 Dec 2022 22:52:01 +0100 Subject: [PATCH] =?UTF-8?q?Edition=20UEs:=20renum=C3=A9rote=20si=20besoin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_edit_ue.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index d581bb65..1ce7c347 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 )