From 567d95b61d54dcd324944623445e0721171f523e Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 12 Dec 2021 16:24:50 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20association=20=C3=A0=20une=20nouvelle=20?= =?UTF-8?q?version=20de=20programme:=20rattachement=20des=20poids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_formsemestre_edit.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index b63e5678dd..8618542dd6 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -30,8 +30,10 @@ import flask from flask import url_for, g, request from flask_login import current_user -from app.auth.models import User +from app import db +from app.auth.models import User +from app.models import ModuleImpl, Evaluation, EvaluationUEPoids import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu from app.scodoc import sco_cache @@ -1197,6 +1199,17 @@ def _reassociate_moduleimpls(cnx, formsemestre_id, ues_old2new, modules_old2new) for mod in modimpls: mod["module_id"] = modules_old2new[mod["module_id"]] sco_moduleimpl.do_moduleimpl_edit(mod, formsemestre_id=formsemestre_id) + # Update poids des évaluations + # les poids associent les évaluations aux UE (qui ont changé d'id) + for poids in EvaluationUEPoids.query.filter( + EvaluationUEPoids.evaluation_id == Evaluation.id, + Evaluation.moduleimpl_id == ModuleImpl.id, + ModuleImpl.formsemestre_id == formsemestre_id, + ): + poids.ue_id = ues_old2new[poids.ue_id] + db.session.add(poids) + db.session.commit() + # update decisions: events = sco_etud.scolar_events_list(cnx, args={"formsemestre_id": formsemestre_id}) for e in events: