forked from ScoDoc/DocScoDoc
Fix: creattion groupe (numero)
This commit is contained in:
parent
448ded422a
commit
a155655e00
@ -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()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.3.30"
|
||||
SCOVERSION = "9.3.31"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user