diff --git a/app/models/modules.py b/app/models/modules.py index d4c70c038..c0bb84ac7 100644 --- a/app/models/modules.py +++ b/app/models/modules.py @@ -6,6 +6,7 @@ from app.models import APO_CODE_STR_LEN from app.models.but_refcomp import ApcParcours, app_critiques_modules, parcours_modules from app.scodoc import sco_utils as scu from app.scodoc.sco_codes_parcours import UE_SPORT +from app.scodoc.sco_exceptions import ScoValueError from app.scodoc.sco_utils import ModuleType @@ -175,6 +176,8 @@ 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(): + raise ScoValueError("Formation verrouillée") changed = False for ue_id, coef in ue_coef_dict.items(): # Existant ? @@ -201,6 +204,8 @@ 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(): + raise ScoValueError("Formation verrouillée") current = self.get_ue_coef_dict() current.update(ue_coef_dict) self.set_ue_coef_dict(current) @@ -211,6 +216,8 @@ class Module(db.Model): def delete_ue_coef(self, ue): """delete coef""" + if self.formation.has_locked_sems(): + raise ScoValueError("Formation verrouillée") ue_coef = ModuleUECoef.query.get((self.id, ue.id)) if ue_coef: db.session.delete(ue_coef) diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 30a84a008..2ea467c2a 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -47,7 +47,6 @@ from app.models import ( ) from app.models import ApcValidationRCUE, ScolarFormSemestreValidation, ScolarEvent from app.models import ScolarNews -from app.models.formations import Matiere import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu from app.scodoc.sco_utils import ModuleType @@ -64,7 +63,6 @@ from app.scodoc import sco_codes_parcours from app.scodoc import sco_edit_apc from app.scodoc import sco_edit_matiere from app.scodoc import sco_edit_module -from app.scodoc import sco_formsemestre from app.scodoc import sco_groups from app.scodoc import sco_moduleimpl from app.scodoc import sco_tag_module @@ -815,7 +813,7 @@ du programme" (menu "Semestre") si vous avez un semestre en cours);