forked from ScoDoc/ScoDoc
Nettoyage code + exception save note
This commit is contained in:
parent
2a63533fc0
commit
d8f1a617bf
@ -583,12 +583,8 @@ def notes_add(
|
|||||||
existing_note = NotesNotes.query.filter_by(
|
existing_note = NotesNotes.query.filter_by(
|
||||||
evaluation_id=evaluation_id, etudid=etudid
|
evaluation_id=evaluation_id, etudid=etudid
|
||||||
).first()
|
).first()
|
||||||
sco_cache.EvaluationCache.delete(evaluation_id)
|
|
||||||
notes_db = sco_evaluation_db.do_evaluation_get_all_notes(
|
|
||||||
evaluation_id
|
|
||||||
)
|
|
||||||
raise ScoBugCatcher(
|
raise ScoBugCatcher(
|
||||||
f"dup: existing={existing_note} etudid={repr(etudid)} value={value} in_db={etudid in notes_db}"
|
f"dup: existing={existing_note}"
|
||||||
) from exc
|
) from exc
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
@ -885,12 +881,20 @@ 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 = f"{evaluation.moduleimpl.module.code}-{indication_date}"
|
eval_name = "%s-%s" % (evaluation.moduleimpl.module.code, indication_date)
|
||||||
|
|
||||||
date_str = (
|
if evaluation.description:
|
||||||
f"""du {evaluation.jour.strftime("%d/%m/%Y")}"""
|
evaltitre = "%s du %s" % (
|
||||||
if evaluation.jour
|
evaluation.description,
|
||||||
else "(sans date)"
|
evaluation.jour.strftime("%d/%m/%Y"),
|
||||||
|
)
|
||||||
|
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}"""
|
eval_titre = f"""{evaluation.description if evaluation.description else "évaluation"} {date_str}"""
|
||||||
|
|
||||||
@ -941,7 +945,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
|||||||
|
|
||||||
filename = f"notes_{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=rows
|
evaluation, formsemestre.titre_annee(), description, lines=L
|
||||||
)
|
)
|
||||||
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