diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index c68e4342..ca6246f4 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -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() diff --git a/sco_version.py b/sco_version.py index 60ae7efa..e793d4d3 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.3.30" +SCOVERSION = "9.3.31" SCONAME = "ScoDoc"