Edition parcours UE: si tous cochés, tronc commun

This commit is contained in:
Emmanuel Viennet 2024-04-12 01:05:02 +02:00
parent cbe85dfb7d
commit a194b4b6e0
1 changed files with 8 additions and 0 deletions

View File

@ -409,6 +409,14 @@ class UniteEns(models.ScoDocModel):
Renvoie (True, "") si ok, sinon (False, error_message)
"""
msg = ""
# Safety check
if self.formation.referentiel_competence is None:
return False, "pas de référentiel de compétence"
# Si tous les parcours, aucun (tronc commun)
if {p.id for p in parcours} == {
p.id for p in self.formation.referentiel_competence.parcours
}:
parcours = []
# Le niveau est-il dans tous ces parcours ? Sinon, l'enlève
prev_niveau = self.niveau_competence
if (