Fix: creation formsemestre

This commit is contained in:
Emmanuel Viennet 2024-02-05 09:03:53 +01:00
parent e611fa4bfc
commit bacd734ab5
2 changed files with 9 additions and 5 deletions

View File

@ -241,7 +241,7 @@ def do_formsemestre_create(args, silent=False):
write_formsemestre_etapes(args) write_formsemestre_etapes(args)
if args["responsables"]: if args["responsables"]:
args["formsemestre_id"] = formsemestre_id args["formsemestre_id"] = formsemestre_id
write_formsemestre_responsables(args) _write_formsemestre_responsables(args)
# create default partition # create default partition
partition_id = sco_groups.partition_create( partition_id = sco_groups.partition_create(
@ -275,7 +275,7 @@ def do_formsemestre_edit(sem, cnx=None, **kw):
_formsemestreEditor.edit(cnx, sem, **kw) _formsemestreEditor.edit(cnx, sem, **kw)
write_formsemestre_etapes(sem) write_formsemestre_etapes(sem)
write_formsemestre_responsables(sem) _write_formsemestre_responsables(sem)
sco_cache.invalidate_formsemestre( sco_cache.invalidate_formsemestre(
formsemestre_id=sem["formsemestre_id"] formsemestre_id=sem["formsemestre_id"]
@ -296,7 +296,10 @@ def read_formsemestre_responsables(formsemestre_id: int) -> list[int]: # py3.9+
return [x["responsable_id"] for x in r] return [x["responsable_id"] for x in r]
def write_formsemestre_responsables(sem): def _write_formsemestre_responsables(sem): # TODO old, à ré-écrire avec models
sem["responsables"] = [
uid for uid in sem["responsables"] if (uid is not None) and (uid != -1)
]
return _write_formsemestre_aux(sem, "responsables", "responsable_id") return _write_formsemestre_aux(sem, "responsables", "responsable_id")
@ -362,10 +365,11 @@ def read_formsemestre_etapes(formsemestre_id): # OBSOLETE
return [ApoEtapeVDI(x["etape_apo"]) for x in r if x["etape_apo"]] return [ApoEtapeVDI(x["etape_apo"]) for x in r if x["etape_apo"]]
def write_formsemestre_etapes(sem): def write_formsemestre_etapes(sem): # TODO old, à ré-écrire avec models
return _write_formsemestre_aux(sem, "etapes", "etape_apo") return _write_formsemestre_aux(sem, "etapes", "etape_apo")
# TODO old, à ré-écrire avec models
def _write_formsemestre_aux(sem, fieldname, valuename): def _write_formsemestre_aux(sem, fieldname, valuename):
"""fieldname: 'etapes' ou 'responsables' """fieldname: 'etapes' ou 'responsables'
valuename: 'etape_apo' ou 'responsable_id' valuename: 'etape_apo' ou 'responsable_id'

View File

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