1
0
forked from ScoDoc/ScoDoc

Fix: import formation xml

This commit is contained in:
Emmanuel Viennet 2023-02-21 14:57:16 +01:00
parent 335395db33
commit 639941bc37
2 changed files with 3 additions and 2 deletions

View File

@ -293,11 +293,11 @@ def formation_import_xml(doc: str, import_tags=True, use_local_refcomp=False):
referentiel_competence_id = _formation_retreive_refcomp(f_dict)
f_dict["referentiel_competence_id"] = referentiel_competence_id
# find new version number
formations = Formation.query.filter_by(
formations: list[Formation] = Formation.query.filter_by(
acronyme=f_dict["acronyme"], titre=f_dict["titre"], dept_id=f_dict["dept_id"]
)
if formations.count():
version = max(f["version"] or 0 for f in formations)
version = max(f.version or 0 for f in formations)
else:
version = 0
f_dict["version"] = version + 1

View File

@ -335,6 +335,7 @@ def test_formations(test_client):
def test_import_formation(test_client, filename="formation-exemple-1.xml"):
"""Test import/export formations"""
G = sco_fake_gen.ScoFake(verbose=False)
# Lecture fichier XML local:
with open(
os.path.join(RESOURCES_DIR, "formations", filename),