From c6c7187c348011eb1aa987371c877174af112928 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 29 Sep 2022 22:39:54 +0200 Subject: [PATCH] fix edit ordre UEs --- app/scodoc/sco_edit_formation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/scodoc/sco_edit_formation.py b/app/scodoc/sco_edit_formation.py index 752bdef68..9167e7620 100644 --- a/app/scodoc/sco_edit_formation.py +++ b/app/scodoc/sco_edit_formation.py @@ -378,7 +378,10 @@ def ue_move(ue_id, after=0, redirect=1): after = int(after) # 0: deplace avant, 1 deplace apres if after not in (0, 1): raise ValueError('invalid value for "after"') - others = ue.formation.ues.order_by(UniteEns.numero).all() + others_q = ue.formation.ues.order_by(UniteEns.numero) + if ue.formation.is_apc(): + others_q = others_q.filter_by(semestre_idx=ue.semestre_idx) + others = others_q.all() if len({o.numero for o in others}) != len(others): # il y a des numeros identiques ! scu.objects_renumber(db, others)