diff --git a/app/scodoc/sco_saisie_excel.py b/app/scodoc/sco_saisie_excel.py index ee9e357d9..38f65243d 100644 --- a/app/scodoc/sco_saisie_excel.py +++ b/app/scodoc/sco_saisie_excel.py @@ -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( - evaluations, notes_by_eval, comment, diag, rows=rows + 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 {modules_str}""", url=status_url, - max_frequency=30 * 60, # 30 minutes + max_frequency=10 * 60, # 10 minutes ) msg = "
" + "\n".join(messages_by_eval.values()) + "
" @@ -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"""
""" 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(