Table recap.: export evaluations en excel

This commit is contained in:
Emmanuel Viennet 2022-05-10 10:06:51 +02:00
parent 6e43ec6feb
commit 61061d4905
3 changed files with 11 additions and 5 deletions

View File

@ -287,7 +287,7 @@ class FormSemestre(db.Model):
""" """
if not self.etapes: if not self.etapes:
return "" 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: def responsables_str(self, abbrev_prenom=True) -> str:
"""chaîne "J. Dupond, X. Martin" """chaîne "J. Dupond, X. Martin"
@ -449,10 +449,15 @@ class FormSemestreEtape(db.Model):
db.Integer, db.Integer,
db.ForeignKey("notes_formsemestre.id"), 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) 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): def __repr__(self):
return f"<Etape {self.id} apo={self.etape_apo}>" return f"<Etape {self.id} apo={self.etape_apo!r}>"
def as_apovdi(self): def as_apovdi(self):
return ApoEtapeVDI(self.etape_apo) return ApoEtapeVDI(self.etape_apo)

View File

@ -85,7 +85,7 @@ def formsemestre_recapcomplet(
""" """
formsemestre = FormSemestre.query.get_or_404(formsemestre_id) formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
file_formats = {"csv", "json", "xls", "xlsx", "xlsall", "xml"} 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: if tabformat not in supported_formats:
raise ScoValueError(f"Format non supporté: {tabformat}") raise ScoValueError(f"Format non supporté: {tabformat}")
is_file = tabformat in file_formats is_file = tabformat in file_formats
@ -131,7 +131,8 @@ def formsemestre_recapcomplet(
for (format, label) in ( for (format, label) in (
("html", "Tableau"), ("html", "Tableau"),
("evals", "Avec toutes les évaluations"), ("evals", "Avec toutes les évaluations"),
("xlsx", "Excel non formatté"), ("xlsx", "Excel (non formatté)"),
("xlsall", "Excel avec évaluations"),
("xml", "Bulletins XML (obsolète)"), ("xml", "Bulletins XML (obsolète)"),
("json", "Bulletins JSON"), ("json", "Bulletins JSON"),
): ):

View File

@ -100,7 +100,7 @@ $(function () {
}, },
{ {
// Elimine les 0 à gauche pour les exports excel et les "copy" // 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) { render: function (data, type, row) {
return type === 'export' ? data.replace(/0(\d\..*)/, '$1') : data; return type === 'export' ? data.replace(/0(\d\..*)/, '$1') : data;
} }