Fix: upload notes excel d'une éval si une seule éval.

This commit is contained in:
Emmanuel Viennet 2024-10-04 08:14:19 +02:00
parent 820e42ac28
commit f7f55c2494

View File

@ -617,6 +617,7 @@ def do_evaluations_upload_xls(
) )
# -- News # -- News
obj_id = None
if len(evaluations) > 1: if len(evaluations) > 1:
modules_str = ", ".join( modules_str = ", ".join(
{ {
@ -645,7 +646,8 @@ def do_evaluations_upload_xls(
obj_id = ( obj_id = (
formsemestre.id if formsemestre else (modimpl.id if modimpl else None) formsemestre.id if formsemestre else (modimpl.id if modimpl else None)
) )
else: elif len(evaluations) > 0:
evaluation = evaluation or evaluations[0]
modules_str = ( modules_str = (
evaluation.moduleimpl.module.titre or evaluation.moduleimpl.module.code evaluation.moduleimpl.module.titre or evaluation.moduleimpl.module.code
) )
@ -655,13 +657,14 @@ def do_evaluations_upload_xls(
moduleimpl_id=evaluation.moduleimpl_id, moduleimpl_id=evaluation.moduleimpl_id,
) )
obj_id = evaluation.moduleimpl_id obj_id = evaluation.moduleimpl_id
ScolarNews.add( if obj_id is not None:
typ=ScolarNews.NEWS_NOTE, ScolarNews.add(
obj=obj_id, typ=ScolarNews.NEWS_NOTE,
text=f"""Notes dans <a href="{status_url}">{modules_str}</a>""", obj=obj_id,
url=status_url, text=f"""Notes dans <a href="{status_url}">{modules_str}</a>""",
max_frequency=10 * 60, # 10 minutes url=status_url,
) max_frequency=10 * 60, # 10 minutes
)
msg = "<div>" + "\n".join(messages_by_eval.values()) + "</div>" msg = "<div>" + "\n".join(messages_by_eval.values()) + "</div>"
if etudids_with_decisions: if etudids_with_decisions: