From ff73ba8a5b5eb9cbc133b88c1cdbf0cbcb2cd8ee Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 21 Jun 2023 13:09:29 +0200 Subject: [PATCH] Enhance exception handling --- app/comp/moy_mod.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/comp/moy_mod.py b/app/comp/moy_mod.py index d86eccbf5c..f69999a724 100644 --- a/app/comp/moy_mod.py +++ b/app/comp/moy_mod.py @@ -322,7 +322,13 @@ class ModuleImplResultsAPC(ModuleImplResults): modimpl = ModuleImpl.query.get(self.moduleimpl_id) nb_etuds, nb_evals = self.evals_notes.shape nb_ues = evals_poids_df.shape[1] - assert evals_poids_df.shape[0] == nb_evals # compat notes/poids + if evals_poids_df.shape[0] != nb_evals: + # compat notes/poids: race condition ? + app.critical_error( + f"""compute_module_moy: evals_poids_df.shape[0] != nb_evals ({ + evals_poids_df.shape[0]} != {nb_evals}) + """ + ) if nb_etuds == 0: return pd.DataFrame(index=[], columns=evals_poids_df.columns) if nb_ues == 0: