forked from ScoDoc/DocScoDoc
Liste saisies de notes: formattage des valeurs
This commit is contained in:
parent
9cc7a80fb0
commit
a3cccac2d2
@ -180,7 +180,7 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html"):
|
|||||||
les évaluations du semestre.
|
les évaluations du semestre.
|
||||||
"""
|
"""
|
||||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id, raise_soft_exc=True)
|
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
|
"""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,
|
FROM notes_notes n, notes_evaluation e, notes_moduleimpl mi,
|
||||||
notes_modules mod, identite i, "user" u
|
notes_modules mod, identite i, "user" u
|
||||||
@ -194,6 +194,10 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html"):
|
|||||||
""",
|
""",
|
||||||
{"formsemestre_id": formsemestre_id},
|
{"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 = (
|
columns_ids = (
|
||||||
"date",
|
"date",
|
||||||
"code_nip",
|
"code_nip",
|
||||||
@ -223,7 +227,7 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html"):
|
|||||||
tab = GenTable(
|
tab = GenTable(
|
||||||
titles=titles,
|
titles=titles,
|
||||||
columns_ids=columns_ids,
|
columns_ids=columns_ids,
|
||||||
rows=r,
|
rows=rows,
|
||||||
html_title="<h2>Saisies de notes dans %s</h2>" % sem["titreannee"],
|
html_title="<h2>Saisies de notes dans %s</h2>" % sem["titreannee"],
|
||||||
html_class="table_leftalign table_coldate gt_table_searchable",
|
html_class="table_leftalign table_coldate gt_table_searchable",
|
||||||
html_class_ignore_default=True,
|
html_class_ignore_default=True,
|
||||||
|
@ -399,6 +399,9 @@ XLSX_SUFFIX = ".xlsx"
|
|||||||
XML_MIMETYPE = "text/xml"
|
XML_MIMETYPE = "text/xml"
|
||||||
XML_SUFFIX = ".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]:
|
def get_mime_suffix(format_code: str) -> tuple[str, str]:
|
||||||
"""Returns (MIME, SUFFIX) from format_code == "xls", "xml", ...
|
"""Returns (MIME, SUFFIX) from format_code == "xls", "xml", ...
|
||||||
|
Loading…
Reference in New Issue
Block a user