From 8652ef2e7b1e5d210681095905be6c4adb46ce7d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 28 Jan 2024 22:36:33 +0100 Subject: [PATCH] API: numero groupe par defaut --- app/api/partitions.py | 7 +++++++ sco_version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/api/partitions.py b/app/api/partitions.py index 50660fb66..7b47c3148 100644 --- a/app/api/partitions.py +++ b/app/api/partitions.py @@ -311,6 +311,13 @@ def group_create(partition_id: int): # partition-group-create args["group_name"] = args["group_name"].strip() if not GroupDescr.check_name(partition, args["group_name"]): return json_error(API_CLIENT_ERROR, "invalid group_name") + + # le numero est optionnel + numero = args.get("numero") + if numero is None: + numeros = [gr.numero or 0 for gr in partition.groups] + numero = (max(numeros) + 1) if numeros else 0 + args["numero"] = numero args["partition_id"] = partition_id try: group = GroupDescr(**args) diff --git a/sco_version.py b/sco_version.py index ebe54b06f..35a788bfb 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.6.87" +SCOVERSION = "9.6.88" SCONAME = "ScoDoc"