From c547990eef1b9b1d8c0d0e01820696cd25a9d02b Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 9 Jun 2023 19:39:39 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Fix:=20affichage=20moyenne=20=C3=A9valution?= =?UTF-8?q?=20/=2020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_moduleimpl_status.py | 3 ++- sco_version.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index a70cb0f49..838da20ac 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -57,6 +57,7 @@ from app.scodoc import sco_moduleimpl from app.scodoc import sco_permissions_check from app.tables import list_etuds + # menu evaluation dans moduleimpl def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0) -> str: "Menu avec actions sur une evaluation" @@ -732,7 +733,7 @@ def _ligne_evaluation( ) if etat["moy"]: H.append( - f"""{etat["moy"]} / {evaluation.note_max:g} + f"""{etat["moy"]} / 20   ( Date: Fri, 9 Jun 2023 20:36:31 +0200 Subject: [PATCH 2/3] Tableau bord module: n'affiche pas saisie abs pour groupes vides --- app/scodoc/sco_formsemestre_status.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 8fbe06c40..817d818ff 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -875,11 +875,15 @@ def _make_listes_sem(formsemestre: FormSemestre, with_absences=True): H.append("

Tous les étudiants

") else: H.append("

Groupes de %(partition_name)s

" % partition) + partition_is_empty = True groups = sco_groups.get_partition_groups(partition) if groups: H.append("") for group in groups: n_members = len(sco_groups.get_group_members(group["group_id"])) + if n_members == 0: + continue # skip empty groups + partition_is_empty = False group["url_etat"] = url_for( "absences.EtatAbsencesGr", group_ids=group["group_id"], @@ -912,8 +916,8 @@ def _make_listes_sem(formsemestre: FormSemestre, with_absences=True): H.append("") H.append("
") - else: - H.append('

Aucun groupe dans cette partition') + if partition_is_empty: + H.append('

Aucun groupe peuplé dans cette partition') if sco_groups.sco_permissions_check.can_change_groups(formsemestre.id): H.append( f""" ( Date: Tue, 13 Jun 2023 21:28:37 +0200 Subject: [PATCH 3/3] Fix: clonage formation avec UE BUT externes --- app/models/formsemestre.py | 2 +- app/models/modules.py | 7 ++++--- app/scodoc/sco_edit_ue.py | 1 + app/scodoc/sco_formations.py | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 24468c7fb..680e3ff98 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -317,7 +317,7 @@ class FormSemestre(db.Model): } ) ues = sem_ues.values() - return sorted(ues, key=attrgetter("numero")) + return sorted(ues, key=attrgetter("numero", "acronyme")) else: sem_ues = db.session.query(UniteEns).filter( ModuleImpl.formsemestre_id == self.id, diff --git a/app/models/modules.py b/app/models/modules.py index ed155fdd2..cfc6a994f 100644 --- a/app/models/modules.py +++ b/app/models/modules.py @@ -1,5 +1,6 @@ """ScoDoc 9 models : Modules """ +from operator import attrgetter from flask import current_app from app import db @@ -229,7 +230,7 @@ class Module(db.Model): """delete coef""" if self.formation.has_locked_sems(self.ue.semestre_idx): current_app.logguer.info( - f"delete_ue_coef: locked formation, ignoring request" + "delete_ue_coef: locked formation, ignoring request" ) raise ScoValueError("Formation verrouillée") ue_coef = ModuleUECoef.query.get((self.id, ue.id)) @@ -238,10 +239,10 @@ class Module(db.Model): self.formation.invalidate_module_coefs() def get_ue_coefs_sorted(self): - "les coefs d'UE, trié par numéro d'UE" + "les coefs d'UE, trié par numéro et acronyme d'UE" # je n'ai pas su mettre un order_by sur le backref sans avoir # à redéfinir les relationships... - return sorted(self.ue_coefs, key=lambda x: x.ue.numero) + return sorted(self.ue_coefs, key=attrgetter("numero", "acronyme")) def ue_coefs_list( self, include_zeros=True, ues: list["UniteEns"] = None diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index cd286f895..f41804f13 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -443,6 +443,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No { "input_type": "boolcheckbox", "title": "UE externe", + "readonly": not create, # ne permet pas de transformer une UE existante en externe "explanation": "réservé pour les capitalisations d'UE effectuées à l'extérieur de l'établissement", }, ), diff --git a/app/scodoc/sco_formations.py b/app/scodoc/sco_formations.py index cf0239b90..981908c97 100644 --- a/app/scodoc/sco_formations.py +++ b/app/scodoc/sco_formations.py @@ -626,7 +626,9 @@ def formation_list_table() -> GenTable: 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") + resp = formation_export( + formation_id, export_ids=True, export_external_ues=True, format="xml" + ) xml_data = resp.get_data(as_text=True) new_id, modules_old2new, ues_old2new = formation_import_xml( xml_data, use_local_refcomp=True