Liste saisies de notes: formattage des valeurs

This commit is contained in:
Emmanuel Viennet 2022-06-09 14:01:47 +02:00
parent 9cc7a80fb0
commit a3cccac2d2
2 changed files with 9 additions and 2 deletions

View File

@ -180,7 +180,7 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html"):
les évaluations du semestre.
"""
sem = sco_formsemestre.get_formsemestre(formsemestre_id, raise_soft_exc=True)
r = ndb.SimpleDictFetch(
rows = ndb.SimpleDictFetch(
"""SELECT i.nom, i.prenom, code_nip, n.*, mod.titre, e.description, e.jour, u.user_name, e.id as evaluation_id
FROM notes_notes n, notes_evaluation e, notes_moduleimpl mi,
notes_modules mod, identite i, "user" u
@ -194,6 +194,10 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html"):
""",
{"formsemestre_id": formsemestre_id},
)
# Formatte les notes
keep_numeric = format in scu.FORMATS_NUMERIQUES
for row in rows:
row["value"] = scu.fmt_note(row["value"], keep_numeric=keep_numeric)
columns_ids = (
"date",
"code_nip",
@ -223,7 +227,7 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html"):
tab = GenTable(
titles=titles,
columns_ids=columns_ids,
rows=r,
rows=rows,
html_title="<h2>Saisies de notes dans %s</h2>" % sem["titreannee"],
html_class="table_leftalign table_coldate gt_table_searchable",
html_class_ignore_default=True,

View File

@ -399,6 +399,9 @@ XLSX_SUFFIX = ".xlsx"
XML_MIMETYPE = "text/xml"
XML_SUFFIX = ".xml"
# Format pour lesquels on exporte sans formattage des nombres (pas de perte de précision)
FORMATS_NUMERIQUES = {"csv", "xls", "xlsx", "xml", "json"}
def get_mime_suffix(format_code: str) -> tuple[str, str]:
"""Returns (MIME, SUFFIX) from format_code == "xls", "xml", ...