forked from ScoDoc/ScoDoc
Saisie excel multi-eval: améliore message log
This commit is contained in:
parent
a3394bd779
commit
b80d8fb454
@ -603,14 +603,20 @@ def do_evaluations_upload_xls(
|
||||
|
||||
# -- Enregistre les notes de chaque évaluation
|
||||
with sco_cache.DeferredSemCacheManager():
|
||||
messages_by_eval, etudids_with_decisions = _record_notes_evaluations(
|
||||
messages_by_eval, etudids_with_decisions, modimpl_ids_changed = (
|
||||
_record_notes_evaluations(
|
||||
evaluations, notes_by_eval, comment, diag, rows=rows
|
||||
)
|
||||
)
|
||||
|
||||
# -- News
|
||||
if len(evaluations) > 1:
|
||||
modules_str = ", ".join(
|
||||
[evaluation.moduleimpl.module.code for evaluation in evaluations]
|
||||
{
|
||||
evaluation.moduleimpl.module.code
|
||||
for evaluation in evaluations
|
||||
if evaluation.moduleimpl_id in modimpl_ids_changed
|
||||
}
|
||||
)
|
||||
status_url = (
|
||||
url_for(
|
||||
@ -647,7 +653,7 @@ def do_evaluations_upload_xls(
|
||||
obj=obj_id,
|
||||
text=f"""Chargement notes dans <a href="{status_url}">{modules_str}</a>""",
|
||||
url=status_url,
|
||||
max_frequency=30 * 60, # 30 minutes
|
||||
max_frequency=10 * 60, # 10 minutes
|
||||
)
|
||||
|
||||
msg = "<div>" + "\n".join(messages_by_eval.values()) + "</div>"
|
||||
@ -709,9 +715,12 @@ def _read_notes_from_rows(
|
||||
|
||||
def _record_notes_evaluations(
|
||||
evaluations, notes_by_eval, comment, diag, rows: list[list[str]] | None = None
|
||||
) -> tuple[dict[int, str], set[int]]:
|
||||
) -> tuple[dict[int, str], set[int], set[int]]:
|
||||
"""Enregistre les notes dans les évaluations
|
||||
Return: messages_by_eval, etudids_with_decisions
|
||||
Return:
|
||||
messages_by_eval : dict { evaluation_id : message }
|
||||
etudids_with_decisions : set of etudids with decision and mark changed
|
||||
modimpl_ids_changed : set of ModuleImplId where at least one mark changed
|
||||
"""
|
||||
# -- Check values de chaque évaluation
|
||||
valid_notes_by_eval, etudids_without_notes_by_eval, etudids_absents_by_eval = (
|
||||
@ -720,6 +729,7 @@ def _record_notes_evaluations(
|
||||
|
||||
messages_by_eval: dict[int, str] = {}
|
||||
etudids_with_decisions = set()
|
||||
modimpl_ids_changed = set()
|
||||
for evaluation in evaluations:
|
||||
valid_notes = valid_notes_by_eval.get(evaluation.id)
|
||||
if not valid_notes:
|
||||
@ -730,6 +740,8 @@ def _record_notes_evaluations(
|
||||
)
|
||||
)
|
||||
etudids_with_decisions |= set(etudids_with_decisions_eval)
|
||||
if etudids_changed:
|
||||
modimpl_ids_changed.add(evaluation.moduleimpl_id)
|
||||
msg = f"""<div class="diag-evaluation">
|
||||
<ul>
|
||||
<li><div class="{'diag-change' if etudids_changed else 'diag-nochange'}">
|
||||
@ -761,7 +773,7 @@ def _record_notes_evaluations(
|
||||
</div>"""
|
||||
msg += """</div>"""
|
||||
messages_by_eval[evaluation.id] = msg
|
||||
return messages_by_eval, etudids_with_decisions
|
||||
return messages_by_eval, etudids_with_decisions, modimpl_ids_changed
|
||||
|
||||
|
||||
def _check_notes_evaluations(
|
||||
|
Loading…
Reference in New Issue
Block a user