Fix+code cleaning: saisie notes manquantes

This commit is contained in:
Emmanuel Viennet 2022-09-03 16:17:56 +02:00
parent 227b94ac6a
commit c67d9a4ba5

View File

@ -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 <a href="%(url)s">%(titre)s</a>' % mod,
url=mod["url"],
obj=evaluation.moduleimpl_id,
text=f"""Initialisation notes dans <a href="{url}">{modimpl.module.titre or ""}</a>""",
url=url,
max_frequency=30 * 60,
)
return f"""