Fix: creattion groupe (numero)

This commit is contained in:
Emmanuel Viennet 2022-09-03 08:42:41 +02:00
parent 448ded422a
commit a155655e00
2 changed files with 6 additions and 4 deletions

View File

@ -844,9 +844,11 @@ def create_group(partition_id, group_name="", default=False) -> GroupDescr:
if not GroupDescr.check_name(partition, group_name):
raise ScoValueError(f"Le groupe {group_name} existe déjà dans cette partition")
new_numero = (
max([g.numero if g.numero is not None else 0 for g in partition.groups]) + 1
)
numeros = [g.numero if g.numero is not None else 0 for g in partition.groups]
if len(numeros) > 0:
new_numero = max(numeros) + 1
else:
new_numero = 0
group = GroupDescr(partition=partition, group_name=group_name, numero=new_numero)
db.session.add(group)
db.session.commit()

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.3.30"
SCOVERSION = "9.3.31"
SCONAME = "ScoDoc"