Fix create modules / tests ok.

This commit is contained in:
Emmanuel Viennet 2025-01-07 13:52:01 +01:00
parent b7d4939e4c
commit 9f0bcbc937

View File

@ -228,9 +228,11 @@ class Module(models.ScoDocModel):
formation = data.get("formation")
if formation is None or not isinstance(formation, Formation):
raise ScoValueError("Module.create_from_dict: formation missing")
else: # check ue_id
formation = UniteEns.get_ue(data["ue_id"])
# formation = Formation.get_formation(data["formation_id"])
else:
formation = Formation.get_formation(data["formation_id"])
#
if ue.formation_id != formation.id:
raise ScoValueError("Module.create_from_dict: UE not in formation")
# refuse de créer un module APC avec semestres semestre du module != semestre de l'UE
if formation.is_apc():
if int(data.get("semestre_id", 1)) != ue.semestre_idx: