From 61061d4905dc13d434f20e879434efdb08b1041d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 10 May 2022 10:06:51 +0200 Subject: [PATCH] Table recap.: export evaluations en excel --- app/models/formsemestre.py | 9 +++++++-- app/scodoc/sco_recapcomplet.py | 5 +++-- app/static/js/table_recap.js | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index dee03510..e243c398 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -287,7 +287,7 @@ class FormSemestre(db.Model): """ if not self.etapes: return "" - return ", ".join(sorted([str(x.etape_apo) for x in self.etapes])) + return ", ".join(sorted([etape.etape_apo for etape in self.etapes if etape])) def responsables_str(self, abbrev_prenom=True) -> str: """chaîne "J. Dupond, X. Martin" @@ -449,10 +449,15 @@ class FormSemestreEtape(db.Model): db.Integer, db.ForeignKey("notes_formsemestre.id"), ) + # etape_apo aurait du etre not null, mais oublié etape_apo = db.Column(db.String(APO_CODE_STR_LEN), index=True) + def __bool__(self): + "Etape False if code empty" + return self.etape_apo is not None and (len(self.etape_apo) > 0) + def __repr__(self): - return f"" + return f"" def as_apovdi(self): return ApoEtapeVDI(self.etape_apo) diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index 6a22c195..96d576bf 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -85,7 +85,7 @@ def formsemestre_recapcomplet( """ formsemestre = FormSemestre.query.get_or_404(formsemestre_id) file_formats = {"csv", "json", "xls", "xlsx", "xlsall", "xml"} - supported_formats = file_formats | {"html"} + supported_formats = file_formats | {"html", "evals"} if tabformat not in supported_formats: raise ScoValueError(f"Format non supporté: {tabformat}") is_file = tabformat in file_formats @@ -131,7 +131,8 @@ def formsemestre_recapcomplet( for (format, label) in ( ("html", "Tableau"), ("evals", "Avec toutes les évaluations"), - ("xlsx", "Excel non formatté"), + ("xlsx", "Excel (non formatté)"), + ("xlsall", "Excel avec évaluations"), ("xml", "Bulletins XML (obsolète)"), ("json", "Bulletins JSON"), ): diff --git a/app/static/js/table_recap.js b/app/static/js/table_recap.js index 4dcd0c23..36426b50 100644 --- a/app/static/js/table_recap.js +++ b/app/static/js/table_recap.js @@ -100,7 +100,7 @@ $(function () { }, { // Elimine les 0 à gauche pour les exports excel et les "copy" - targets: ["col_mod", "col_moy_gen", "col_ue", "col_res", "col_sae"], + targets: ["col_mod", "col_moy_gen", "col_ue", "col_res", "col_sae", "evaluation"], render: function (data, type, row) { return type === 'export' ? data.replace(/0(\d\..*)/, '$1') : data; }