From f7f55c2494a536bd8e1ae9551694f28c13a0dc52 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 4 Oct 2024 08:14:19 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20upload=20notes=20excel=20d'une=20=C3=A9v?= =?UTF-8?q?al=20si=20une=20seule=20=C3=A9val.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_saisie_excel.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/scodoc/sco_saisie_excel.py b/app/scodoc/sco_saisie_excel.py index 55f9a66f2..cb972d55e 100644 --- a/app/scodoc/sco_saisie_excel.py +++ b/app/scodoc/sco_saisie_excel.py @@ -617,6 +617,7 @@ def do_evaluations_upload_xls( ) # -- News + obj_id = None if len(evaluations) > 1: modules_str = ", ".join( { @@ -645,7 +646,8 @@ def do_evaluations_upload_xls( obj_id = ( formsemestre.id if formsemestre else (modimpl.id if modimpl else None) ) - else: + elif len(evaluations) > 0: + evaluation = evaluation or evaluations[0] modules_str = ( evaluation.moduleimpl.module.titre or evaluation.moduleimpl.module.code ) @@ -655,13 +657,14 @@ def do_evaluations_upload_xls( moduleimpl_id=evaluation.moduleimpl_id, ) obj_id = evaluation.moduleimpl_id - ScolarNews.add( - typ=ScolarNews.NEWS_NOTE, - obj=obj_id, - text=f"""Notes dans {modules_str}""", - url=status_url, - max_frequency=10 * 60, # 10 minutes - ) + if obj_id is not None: + ScolarNews.add( + typ=ScolarNews.NEWS_NOTE, + obj=obj_id, + text=f"""Notes dans {modules_str}""", + url=status_url, + max_frequency=10 * 60, # 10 minutes + ) msg = "
" + "\n".join(messages_by_eval.values()) + "
" if etudids_with_decisions: