Fix: chargement ref. MT2E

This commit is contained in:
Emmanuel Viennet 2022-06-23 14:16:53 +02:00
parent bb68b85b61
commit 99c22bdb83
1 changed files with 6 additions and 5 deletions

View File

@ -197,10 +197,11 @@ def refcomp_load(formation_id=None):
refs_distrib_dict = [{"id": 0, "specialite": "Aucun", "created": "", "serial": ""}] refs_distrib_dict = [{"id": 0, "specialite": "Aucun", "created": "", "serial": ""}]
i = 1 i = 1
for filename in refs_distrib_files: for filename in refs_distrib_files:
m = re.match(r".*/but-([A-Za-z_]+)-([0-9]+)-([0-9]+).xml", str(filename)) m = re.match(r".*/but-([A-Za-z0-9_]+)-([0-9]+)-([0-9]+).xml", str(filename))
if ( if not m:
m log(f"refcomp_load: ignoring {filename} (invalid filename)")
and ApcReferentielCompetences.query.filter_by( elif (
ApcReferentielCompetences.query.filter_by(
scodoc_orig_filename=Path(filename).name, dept_id=g.scodoc_dept_id scodoc_orig_filename=Path(filename).name, dept_id=g.scodoc_dept_id
).count() ).count()
== 0 == 0
@ -216,7 +217,7 @@ def refcomp_load(formation_id=None):
) )
i += 1 i += 1
else: else:
log(f"refcomp_load: ignoring {filename} (invalid filename)") log(f"refcomp_load: ignoring {filename} (already loaded)")
form = RefCompLoadForm() form = RefCompLoadForm()
form.referentiel_standard.choices = [ form.referentiel_standard.choices = [