1
0
forked from ScoDoc/ScoDoc

Fix: changement de référentiel de compétences

This commit is contained in:
Emmanuel Viennet 2023-07-17 15:09:17 +02:00
parent 538a5427ba
commit 1b297580c9
2 changed files with 10 additions and 6 deletions

View File

@ -224,7 +224,7 @@ def do_formsemestres_associate_new_version(
_reassociate_moduleimpls(formsemestre, ues_old2new, modules_old2new)
db.session.commit()
return formation_id
return new_formation_id
def _reassociate_moduleimpls(

View File

@ -149,10 +149,14 @@ def refcomp_assoc_formation(formation_id: int):
db.session.get(ApcReferentielCompetences, referentiel_competence_id)
is not None
)
formation.referentiel_competence_id = referentiel_competence_id
db.session.add(formation)
db.session.commit()
flash("nouveau référentiel de compétences associé")
if formation.referentiel_competence_id != referentiel_competence_id:
formation.refcomp_desassoc()
formation.referentiel_competence_id = referentiel_competence_id
db.session.add(formation)
db.session.commit()
flash("Nouveau référentiel de compétences associé")
else:
flash("Pas de changements")
return redirect(
url_for(
"notes.ue_table", scodoc_dept=g.scodoc_dept, formation_id=formation_id
@ -172,7 +176,7 @@ def refcomp_assoc_formation(formation_id: int):
@permission_required(Permission.ScoChangeFormation)
def refcomp_desassoc_formation(formation_id: int):
"""Désassocie la formation de son ref. de compétence"""
formation = Formation.query.get_or_404(formation_id)
formation: Formation = Formation.query.get_or_404(formation_id)
formation.refcomp_desassoc()
return redirect(
url_for("notes.ue_table", scodoc_dept=g.scodoc_dept, formation_id=formation.id)