From 99c22bdb83693cf8ad3bd1e545e92a87d7434c43 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 23 Jun 2022 14:16:53 +0200 Subject: [PATCH] Fix: chargement ref. MT2E --- app/views/refcomp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/refcomp.py b/app/views/refcomp.py index fb9e2eb1b..53a2a4647 100644 --- a/app/views/refcomp.py +++ b/app/views/refcomp.py @@ -197,10 +197,11 @@ def refcomp_load(formation_id=None): refs_distrib_dict = [{"id": 0, "specialite": "Aucun", "created": "", "serial": ""}] i = 1 for filename in refs_distrib_files: - m = re.match(r".*/but-([A-Za-z_]+)-([0-9]+)-([0-9]+).xml", str(filename)) - if ( - m - and ApcReferentielCompetences.query.filter_by( + m = re.match(r".*/but-([A-Za-z0-9_]+)-([0-9]+)-([0-9]+).xml", str(filename)) + if not m: + log(f"refcomp_load: ignoring {filename} (invalid filename)") + elif ( + ApcReferentielCompetences.query.filter_by( scodoc_orig_filename=Path(filename).name, dept_id=g.scodoc_dept_id ).count() == 0 @@ -216,7 +217,7 @@ def refcomp_load(formation_id=None): ) i += 1 else: - log(f"refcomp_load: ignoring {filename} (invalid filename)") + log(f"refcomp_load: ignoring {filename} (already loaded)") form = RefCompLoadForm() form.referentiel_standard.choices = [