From a7ada3a1d58e160b5cdd282d5c625002913ac849 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 28 Feb 2023 22:06:25 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20=C3=A9dition=20coefs=20formation=20verro?= =?UTF-8?q?uill=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/modules.py | 16 +++++++++++++--- sco_version.py | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/models/modules.py b/app/models/modules.py index e36101481..2ea75b66a 100644 --- a/app/models/modules.py +++ b/app/models/modules.py @@ -1,5 +1,6 @@ """ScoDoc 9 models : Modules """ +from flask import current_app from app import db from app.models import APO_CODE_STR_LEN @@ -176,7 +177,10 @@ class Module(db.Model): ue_coef_dict = { ue_id : coef } Les coefs nuls (zéro) ne sont pas stockés: la relation est supprimée. """ - if self.formation.has_locked_sems(): + if self.formation.has_locked_sems(self.ue.semestre_idx): + current_app.logguer.info( + f"set_ue_coef_dict: locked formation, ignoring request" + ) raise ScoValueError("Formation verrouillée") changed = False for ue_id, coef in ue_coef_dict.items(): @@ -204,7 +208,10 @@ class Module(db.Model): def update_ue_coef_dict(self, ue_coef_dict: dict): """update coefs vers UE (ajoute aux existants)""" - if self.formation.has_locked_sems(): + if self.formation.has_locked_sems(self.ue.semestre_idx): + current_app.logguer.info( + f"update_ue_coef_dict: locked formation, ignoring request" + ) raise ScoValueError("Formation verrouillée") current = self.get_ue_coef_dict() current.update(ue_coef_dict) @@ -216,7 +223,10 @@ class Module(db.Model): def delete_ue_coef(self, ue): """delete coef""" - if self.formation.has_locked_sems(): + if self.formation.has_locked_sems(self.ue.semestre_idx): + current_app.logguer.info( + f"delete_ue_coef: locked formation, ignoring request" + ) raise ScoValueError("Formation verrouillée") ue_coef = ModuleUECoef.query.get((self.id, ue.id)) if ue_coef: diff --git a/sco_version.py b/sco_version.py index 46167352f..fecae1f62 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.56" +SCOVERSION = "9.4.57" SCONAME = "ScoDoc"