Fix: édition coefs formation verrouillée

This commit is contained in:
Emmanuel Viennet 2023-02-28 22:06:25 +01:00
parent 015867d726
commit a7ada3a1d5
2 changed files with 14 additions and 4 deletions

View File

@ -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:

View File

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