From c67d9a4ba5d2edb24e8684c5f7e83ee0265bfedf Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 3 Sep 2022 16:17:56 +0200 Subject: [PATCH] Fix+code cleaning: saisie notes manquantes --- app/scodoc/sco_saisie_notes.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index b7a6acc4f..1dbf0ba3a 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -302,8 +302,6 @@ def do_evaluation_upload_xls(): def do_evaluation_set_missing(evaluation_id, value, dialog_confirmed=False): """Initialisation des notes manquantes""" - # XXX E = sco_evaluation_db.do_evaluation_list({"evaluation_id": evaluation_id})[0] - # XXX M = sco_moduleimpl.moduleimpl_withmodule_list(moduleimpl_id=E["moduleimpl_id"])[0] evaluation = Evaluation.query.get_or_404(evaluation_id) modimpl = evaluation.moduleimpl @@ -357,19 +355,16 @@ def do_evaluation_set_missing(evaluation_id, value, dialog_confirmed=False): comment = "Initialisation notes manquantes" nb_changed, _, _ = notes_add(current_user, evaluation_id, L, comment) # news - M = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0] - mod = sco_edit_module.module_list(args={"module_id": M["module_id"]})[0] - mod["moduleimpl_id"] = M["moduleimpl_id"] - mod["url"] = url_for( + url = url_for( "notes.moduleimpl_status", scodoc_dept=g.scodoc_dept, - moduleimpl_id=mod["moduleimpl_id"], + moduleimpl_id=evaluation.moduleimpl_id, ) ScolarNews.add( typ=ScolarNews.NEWS_NOTE, - obj=M["moduleimpl_id"], - text='Initialisation notes dans %(titre)s' % mod, - url=mod["url"], + obj=evaluation.moduleimpl_id, + text=f"""Initialisation notes dans {modimpl.module.titre or ""}""", + url=url, max_frequency=30 * 60, ) return f"""