Fix: import formation xml
This commit is contained in:
parent
335395db33
commit
639941bc37
@ -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)
|
referentiel_competence_id = _formation_retreive_refcomp(f_dict)
|
||||||
f_dict["referentiel_competence_id"] = referentiel_competence_id
|
f_dict["referentiel_competence_id"] = referentiel_competence_id
|
||||||
# find new version number
|
# 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"]
|
acronyme=f_dict["acronyme"], titre=f_dict["titre"], dept_id=f_dict["dept_id"]
|
||||||
)
|
)
|
||||||
if formations.count():
|
if formations.count():
|
||||||
version = max(f["version"] or 0 for f in formations)
|
version = max(f.version or 0 for f in formations)
|
||||||
else:
|
else:
|
||||||
version = 0
|
version = 0
|
||||||
f_dict["version"] = version + 1
|
f_dict["version"] = version + 1
|
||||||
|
@ -335,6 +335,7 @@ def test_formations(test_client):
|
|||||||
def test_import_formation(test_client, filename="formation-exemple-1.xml"):
|
def test_import_formation(test_client, filename="formation-exemple-1.xml"):
|
||||||
"""Test import/export formations"""
|
"""Test import/export formations"""
|
||||||
G = sco_fake_gen.ScoFake(verbose=False)
|
G = sco_fake_gen.ScoFake(verbose=False)
|
||||||
|
|
||||||
# Lecture fichier XML local:
|
# Lecture fichier XML local:
|
||||||
with open(
|
with open(
|
||||||
os.path.join(RESOURCES_DIR, "formations", filename),
|
os.path.join(RESOURCES_DIR, "formations", filename),
|
||||||
|
Loading…
Reference in New Issue
Block a user