Fix: chargement ref. MT2E

This commit is contained in:
Emmanuel Viennet 2022-06-23 14:16:53 +02:00
parent bb68b85b61
commit 99c22bdb83

View File

@ -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 = [