From fb9571dde2a8bc9b32c5dfc707e1d303bd85d68a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 13 Jul 2022 19:23:55 +0200 Subject: [PATCH] Clonage formations. Close #444 --- app/scodoc/sco_edit_ue.py | 1 + app/scodoc/sco_formations.py | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 06d9c8c1..6658a635 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -86,6 +86,7 @@ _ueEditor = ndb.EditableTable( "coefficient", "coef_rcue", "color", + "niveau_competence_id", ), sortkey="numero", input_formators={ diff --git a/app/scodoc/sco_formations.py b/app/scodoc/sco_formations.py index 4526ae63..8128021f 100644 --- a/app/scodoc/sco_formations.py +++ b/app/scodoc/sco_formations.py @@ -31,7 +31,7 @@ from operator import itemgetter import xml.dom.minidom import flask -from flask import g, url_for, request +from flask import flash, g, url_for, request from flask_login import current_user import app.scodoc.sco_utils as scu @@ -65,6 +65,7 @@ _formationEditor = ndb.EditableTable( "formation_code", "type_parcours", "code_specialite", + "referentiel_competence_id", ), filter_dept=True, sortkey="acronyme", @@ -104,7 +105,7 @@ def formation_export( """Get a formation, with UE, matieres, modules in desired format """ - formation = Formation.query.get_or_404(formation_id) + formation: Formation = Formation.query.get_or_404(formation_id) F = formation.to_dict() selector = {"formation_id": formation_id} if not export_external_ues: @@ -424,17 +425,18 @@ def formation_list_table(formation_id=None, args={}): def formation_create_new_version(formation_id, redirect=True): "duplicate formation, with new version number" + formation = Formation.query.get_or_404(formation_id) resp = formation_export(formation_id, export_ids=True, format="xml") xml_data = resp.get_data(as_text=True) new_id, modules_old2new, ues_old2new = formation_import_xml(xml_data) # news - F = formation_list(args={"formation_id": new_id})[0] ScolarNews.add( typ=ScolarNews.NEWS_FORM, obj=new_id, - text="Nouvelle version de la formation %(acronyme)s" % F, + text=f"Nouvelle version de la formation {formation.acronyme}", ) if redirect: + flash("Nouvelle version !") return flask.redirect( url_for( "notes.ue_table",