forked from ScoDoc/ScoDoc
Fix regression: saisie notes tableur
This commit is contained in:
parent
5f0ac236d7
commit
c5f5cb7daa
@ -885,21 +885,18 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
|||||||
indication_date = evaluation.jour.isoformat()
|
indication_date = evaluation.jour.isoformat()
|
||||||
else:
|
else:
|
||||||
indication_date = scu.sanitize_filename(evaluation.description or "")[:12]
|
indication_date = scu.sanitize_filename(evaluation.description or "")[:12]
|
||||||
eval_name = "%s-%s" % (evaluation.moduleimpl.module.code, indication_date)
|
eval_name = f"{evaluation.moduleimpl.module.code}-{indication_date}"
|
||||||
|
|
||||||
if evaluation.description:
|
date_str = (
|
||||||
evaltitre = "%s du %s" % (
|
f"""du {evaluation.jour.strftime("%d/%m/%Y")}"""
|
||||||
evaluation.description,
|
if evaluation.jour
|
||||||
evaluation.jour.strftime("%d/%m/%Y"),
|
else "(sans date)"
|
||||||
)
|
|
||||||
else:
|
|
||||||
evaltitre = "évaluation du %s" % evaluation.jour.strftime("%d/%m/%Y")
|
|
||||||
description = "%s en %s (%s) resp. %s" % (
|
|
||||||
evaltitre,
|
|
||||||
evaluation.moduleimpl.module.abbrev or "",
|
|
||||||
evaluation.moduleimpl.module.code,
|
|
||||||
mod_responsable["prenomnom"],
|
|
||||||
)
|
)
|
||||||
|
eval_titre = f"""{evaluation.description if evaluation.description else "évaluation"} {date_str}"""
|
||||||
|
|
||||||
|
description = f"""{eval_titre} en {evaluation.moduleimpl.module.abbrev or ""} ({
|
||||||
|
evaluation.moduleimpl.module.code
|
||||||
|
}) resp. {mod_responsable["prenomnom"]}"""
|
||||||
|
|
||||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
||||||
group_ids=group_ids,
|
group_ids=group_ids,
|
||||||
@ -909,10 +906,8 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
|||||||
)
|
)
|
||||||
groups = sco_groups.listgroups(groups_infos.group_ids)
|
groups = sco_groups.listgroups(groups_infos.group_ids)
|
||||||
gr_title_filename = sco_groups.listgroups_filename(groups)
|
gr_title_filename = sco_groups.listgroups_filename(groups)
|
||||||
# gr_title = sco_groups.listgroups_abbrev(groups)
|
|
||||||
if None in [g["group_name"] for g in groups]: # tous les etudiants
|
if None in [g["group_name"] for g in groups]: # tous les etudiants
|
||||||
getallstudents = True
|
getallstudents = True
|
||||||
# gr_title = "tous"
|
|
||||||
gr_title_filename = "tous"
|
gr_title_filename = "tous"
|
||||||
else:
|
else:
|
||||||
getallstudents = False
|
getallstudents = False
|
||||||
@ -924,7 +919,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# une liste de liste de chaines: lignes de la feuille de calcul
|
# une liste de liste de chaines: lignes de la feuille de calcul
|
||||||
L = []
|
rows = []
|
||||||
|
|
||||||
etuds = _get_sorted_etuds(evaluation, etudids, formsemestre.id)
|
etuds = _get_sorted_etuds(evaluation, etudids, formsemestre.id)
|
||||||
for e in etuds:
|
for e in etuds:
|
||||||
@ -932,7 +927,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
|||||||
groups = sco_groups.get_etud_groups(etudid, formsemestre.id)
|
groups = sco_groups.get_etud_groups(etudid, formsemestre.id)
|
||||||
grc = sco_groups.listgroups_abbrev(groups)
|
grc = sco_groups.listgroups_abbrev(groups)
|
||||||
|
|
||||||
L.append(
|
rows.append(
|
||||||
[
|
[
|
||||||
str(etudid),
|
str(etudid),
|
||||||
e["nom"].upper(),
|
e["nom"].upper(),
|
||||||
@ -944,9 +939,9 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
filename = "notes_%s_%s" % (eval_name, gr_title_filename)
|
filename = f"notes_{eval_name}_{gr_title_filename}"
|
||||||
xls = sco_excel.excel_feuille_saisie(
|
xls = sco_excel.excel_feuille_saisie(
|
||||||
evaluation, formsemestre.titre_annee(), description, lines=L
|
evaluation, formsemestre.titre_annee(), description, lines=rows
|
||||||
)
|
)
|
||||||
return scu.send_file(xls, filename, scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE)
|
return scu.send_file(xls, filename, scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user