diff --git a/app/scodoc/sco_undo_notes.py b/app/scodoc/sco_undo_notes.py index 5cff6fe444..4743ca6cf1 100644 --- a/app/scodoc/sco_undo_notes.py +++ b/app/scodoc/sco_undo_notes.py @@ -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="

Saisies de notes dans %s

" % sem["titreannee"], html_class="table_leftalign table_coldate gt_table_searchable", html_class_ignore_default=True, diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 3449785b5e..924d59db1e 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -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", ...