From fca090649cb24f581899307271144a64b8100658 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 25 Jan 2023 11:17:52 -0300 Subject: [PATCH] =?UTF-8?q?Am=C3=A9liore=20import/export=20formations=20AP?= =?UTF-8?q?C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/formations.py | 3 +- app/models/ues.py | 1 + app/scodoc/sco_edit_apc.py | 10 +-- app/scodoc/sco_edit_ue.py | 12 ++-- app/scodoc/sco_formations.py | 69 ++++++++++++++----- app/scodoc/sco_photos.py | 4 +- .../pn/{form_descr.html => form_descr.j2} | 0 .../pn/{form_mods.html => form_mods.j2} | 3 +- ...ue_coefs.html => form_modules_ue_coefs.j2} | 0 .../pn/{form_ues.html => form_ues.j2} | 0 .../pn/{ue_infos.html => ue_infos.j2} | 0 app/views/notes.py | 9 ++- app/views/pn_modules.py | 2 +- sco_version.py | 2 +- 14 files changed, 81 insertions(+), 34 deletions(-) rename app/templates/pn/{form_descr.html => form_descr.j2} (100%) rename app/templates/pn/{form_mods.html => form_mods.j2} (97%) rename app/templates/pn/{form_modules_ue_coefs.html => form_modules_ue_coefs.j2} (100%) rename app/templates/pn/{form_ues.html => form_ues.j2} (100%) rename app/templates/pn/{ue_infos.html => ue_infos.j2} (100%) diff --git a/app/models/formations.py b/app/models/formations.py index 36e356472..986ef7e74 100644 --- a/app/models/formations.py +++ b/app/models/formations.py @@ -55,7 +55,8 @@ class Formation(db.Model): modules = db.relationship("Module", lazy="dynamic", backref="formation") def __repr__(self): - return f"<{self.__class__.__name__}(id={self.id}, dept_id={self.dept_id}, acronyme='{self.acronyme!r}')>" + return f"""<{self.__class__.__name__}(id={self.id}, dept_id={ + self.dept_id}, acronyme={self.acronyme!r}, version={self.version})>""" def to_html(self) -> str: "titre complet pour affichage" diff --git a/app/models/ues.py b/app/models/ues.py index 94954b93d..596e0bef6 100644 --- a/app/models/ues.py +++ b/app/models/ues.py @@ -111,6 +111,7 @@ class UniteEns(db.Model): e["ects"] = e["ects"] e["coefficient"] = e["coefficient"] if e["coefficient"] else 0.0 e["code_apogee"] = e["code_apogee"] or "" # pas de None + e["parcour"] = self.parcour.to_dict() if self.parcour else None if with_module_ue_coefs: if convert_objects: e["module_ue_coefs"] = [ diff --git a/app/scodoc/sco_edit_apc.py b/app/scodoc/sco_edit_apc.py index 1bea3b71f..b904bd5b5 100644 --- a/app/scodoc/sco_edit_apc.py +++ b/app/scodoc/sco_edit_apc.py @@ -99,7 +99,7 @@ def html_edit_formation_apc( H = [ render_template( - "pn/form_ues.html", + "pn/form_ues.j2", formation=formation, semestre_ids=semestre_ids, editable=editable, @@ -122,7 +122,7 @@ def html_edit_formation_apc( ).first() H += [ render_template( - "pn/form_mods.html", + "pn/form_mods.j2", formation=formation, titre=f"Ressources du S{semestre_idx}", create_element_msg="créer une nouvelle ressource", @@ -138,7 +138,7 @@ def html_edit_formation_apc( if ues_by_sem[semestre_idx].count() > 0 else "", render_template( - "pn/form_mods.html", + "pn/form_mods.j2", formation=formation, titre=f"Situations d'Apprentissage et d'Évaluation (SAÉs) S{semestre_idx}", create_element_msg="créer une nouvelle SAÉ", @@ -154,7 +154,7 @@ def html_edit_formation_apc( if ues_by_sem[semestre_idx].count() > 0 else "", render_template( - "pn/form_mods.html", + "pn/form_mods.j2", formation=formation, titre=f"Autres modules (non BUT) du S{semestre_idx}", create_element_msg="créer un nouveau module", @@ -196,7 +196,7 @@ def html_ue_infos(ue): and ue.matieres.count() == 0 ) return render_template( - "pn/ue_infos.html", + "pn/ue_infos.j2", titre=f"UE {ue.acronyme} {ue.titre}", ue=ue, formsemestres=formsemestres, diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 5d269875e..906493a2a 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -723,7 +723,7 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list "libjs/jQuery-tagEditor/jquery.caret.min.js", "js/module_tag_editor.js", ], - page_title=f"Programme {formation.acronyme}", + page_title=f"Programme {formation.acronyme} v{formation.version}", ), f"""

{formation.to_html()} {lockicon}

@@ -765,7 +765,7 @@ du programme" (menu "Semestre") si vous avez un semestre en cours); # Description de la formation H.append( render_template( - "pn/form_descr.html", + "pn/form_descr.j2", formation=formation, parcours=parcours, editable=editable, @@ -913,8 +913,12 @@ du programme" (menu "Semestre") si vous avez un semestre en cours);
  • Export XML de la formation - (permet de la sauvegarder pour l'échanger avec un autre site) + }">Export XML de la formation ou + sans codes Apogée + (permet de l'enregistrer pour l'échanger avec un autre site)
  • return abort(404, "etudiant inconnu") etud = etuds[0] else: - raise ValueError("etud_photo_html: either etud or etudid must be specified") + abort(404, "etud_photo_html: either etud or etudid must be specified") photo_url = etud_photo_url(etud, size=size) nom = etud.get("nomprenom", etud["nom_disp"]) if title is None: @@ -244,7 +244,7 @@ def photo_pathname(photo_filename: str, size="orig"): elif size == "orig": version = "" else: - raise ValueError("invalid size parameter for photo") + abort(404, "invalid size parameter for photo") if not photo_filename: return False path = os.path.join(PHOTO_DIR, photo_filename) + version + IMAGE_EXT diff --git a/app/templates/pn/form_descr.html b/app/templates/pn/form_descr.j2 similarity index 100% rename from app/templates/pn/form_descr.html rename to app/templates/pn/form_descr.j2 diff --git a/app/templates/pn/form_mods.html b/app/templates/pn/form_mods.j2 similarity index 97% rename from app/templates/pn/form_mods.html rename to app/templates/pn/form_mods.j2 index 805d47081..21677f404 100644 --- a/app/templates/pn/form_mods.html +++ b/app/templates/pn/form_mods.j2 @@ -49,7 +49,8 @@ ({{mod.ue.acronyme}}), {% endif %} - parcours {{ mod.get_parcours()|map(attribute="code")|join(", ")|default('tronc commun', true)|safe + - parcours {{ mod.get_parcours()|map(attribute="code")|join(", ")|default('tronc commun', + true)|safe }} {% if mod.heures_cours or mod.heures_td or mod.heures_tp %} ({{mod.heures_cours|default(" ",true)|safe}}/{{mod.heures_td|default(" ",true)|safe}}/{{mod.heures_tp|default(" ",true)|safe}}, diff --git a/app/templates/pn/form_modules_ue_coefs.html b/app/templates/pn/form_modules_ue_coefs.j2 similarity index 100% rename from app/templates/pn/form_modules_ue_coefs.html rename to app/templates/pn/form_modules_ue_coefs.j2 diff --git a/app/templates/pn/form_ues.html b/app/templates/pn/form_ues.j2 similarity index 100% rename from app/templates/pn/form_ues.html rename to app/templates/pn/form_ues.j2 diff --git a/app/templates/pn/ue_infos.html b/app/templates/pn/ue_infos.j2 similarity index 100% rename from app/templates/pn/ue_infos.html rename to app/templates/pn/ue_infos.j2 diff --git a/app/views/notes.py b/app/views/notes.py index 2e20e2830..d32a7fee2 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -704,10 +704,15 @@ def formation_list(format=None, formation_id=None, args={}): @scodoc @permission_required(Permission.ScoView) @scodoc7func -def formation_export(formation_id, export_ids=False, format=None): +def formation_export( + formation_id, export_ids=False, format=None, export_codes_apo=True +): "Export de la formation au format indiqué (xml ou json)" return sco_formations.formation_export( - formation_id, export_ids=export_ids, format=format + formation_id, + export_ids=export_ids, + format=format, + export_codes_apo=export_codes_apo, ) diff --git a/app/views/pn_modules.py b/app/views/pn_modules.py index c67e79a3e..6868b8bd5 100644 --- a/app/views/pn_modules.py +++ b/app/views/pn_modules.py @@ -216,7 +216,7 @@ def edit_modules_ue_coefs(): """, render_template( - "pn/form_modules_ue_coefs.html", + "pn/form_modules_ue_coefs.j2", formation=formation, data_source=url_for( "notes.table_modules_ue_coefs", diff --git a/sco_version.py b/sco_version.py index d3e3cd25e..56d215357 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.31" +SCOVERSION = "9.4.32" SCONAME = "ScoDoc"