From b36e39cae82f5eadabc0b509a2522a58664bbb9f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 29 Oct 2022 08:22:17 +0200 Subject: [PATCH] Modifie refcomp_desassoc (#506) --- app/models/formations.py | 15 ++++++++++ app/models/modules.py | 3 +- app/views/absences.py | 59 ++++++++++++++++------------------------ app/views/refcomp.py | 4 +-- sco_version.py | 2 +- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/app/models/formations.py b/app/models/formations.py index d42200cd30..4f048d0d4f 100644 --- a/app/models/formations.py +++ b/app/models/formations.py @@ -233,6 +233,21 @@ class Formation(db.Model): .filter(ApcAnneeParcours.parcours_id == parcour.id) ) + def refcomp_desassoc(self): + """Désassocie la formation de son ref. de compétence""" + self.referentiel_competence = None + db.session.add(self) + # Niveaux des UE + for ue in self.ues: + ue.niveau_competence = None + db.session.add(ue) + # Parcours et AC des modules + for mod in self.modules: + mod.parcours = [] + mod.app_critiques = [] + db.session.add(mod) + db.session.commit() + class Matiere(db.Model): """Matières: regroupe les modules d'une UE diff --git a/app/models/modules.py b/app/models/modules.py index 904b8b6351..52bcd508ed 100644 --- a/app/models/modules.py +++ b/app/models/modules.py @@ -66,7 +66,8 @@ class Module(db.Model): super(Module, self).__init__(**kwargs) def __repr__(self): - return f"" + return f"""""" def to_dict(self, convert_objects=False, with_matiere=False, with_ue=False) -> dict: """If convert_objects, convert all attributes to native types diff --git a/app/views/absences.py b/app/views/absences.py index 5dbda369d2..f84398a814 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -677,36 +677,34 @@ def _gen_form_saisie_groupe( moduleimpl_id: optionnel, module concerné. """ H = [ - """ + f"""

- + """ - % ( - "true" if (require_module and not moduleimpl_id) else "false", - len(etuds), - ) ] # Dates odates = [datetime.date(*[int(x) for x in d.split("-")]) for d in dates] @@ -720,16 +718,16 @@ def _gen_form_saisie_groupe( noms_jours.append(jn[idx_jour]) for jour in noms_jours: H.append( - '" + f"""""" ) H.append("") for d in odates: H.append( - '" + f"""""" ) H.append("") H.append("" * len(dates)) @@ -1483,16 +1481,6 @@ def process_billet_absence_form(billet_id): return "\n".join(H) + html_sco_header.sco_footer() -# @bp.route("/essai_api7") -# @scodoc -# @permission_required_compat_scodoc7(Permission.ScoView) -# @scodoc7func -# def essai_api7(x="xxx"): -# "un essai" -# log("arfffffffffffffffffff") -# return "OK OK x=" + str(x) - - @bp.route("/XMLgetAbsEtud", methods=["GET", "POST"]) # pour compat anciens clients PHP @scodoc @permission_required_compat_scodoc7(Permission.ScoView) @@ -1503,7 +1491,6 @@ def XMLgetAbsEtud(beg_date="", end_date=""): etuds = sco_etud.get_etud_info(filled=False) if not etuds: raise APIInvalidParams("étudiant inconnu") - # raise ScoValueError("étudiant inconnu") etud = etuds[0] exp = re.compile(r"^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$") if not exp.match(beg_date): diff --git a/app/views/refcomp.py b/app/views/refcomp.py index 1b2b659d5f..c3b6e24c97 100644 --- a/app/views/refcomp.py +++ b/app/views/refcomp.py @@ -166,9 +166,7 @@ def refcomp_assoc_formation(formation_id: int): 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.referentiel_competence = None - db.session.add(formation) - db.session.commit() + formation.refcomp_desassoc() return redirect( url_for("notes.ue_table", scodoc_dept=g.scodoc_dept, formation_id=formation.id) ) diff --git a/sco_version.py b/sco_version.py index abe234c8bd..a4c2177c6b 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.3.59" +SCOVERSION = "9.3.60" SCONAME = "ScoDoc"
%d étudiants
{len(etuds)} étudiants' - + jour - + " + { jour } +
 ' - + d.strftime("%d/%m/%Y") - + " + { d.strftime("%d/%m/%Y") } +
 AMPM