fix edit ordre UEs

This commit is contained in:
Emmanuel Viennet 2022-09-29 22:39:54 +02:00
parent 453f11084b
commit c6c7187c34
1 changed files with 4 additions and 1 deletions

View File

@ -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)