From aeed4c6fb857ca2ddff8afca126887e95c0e1062 Mon Sep 17 00:00:00 2001 From: VincentCauchois Date: Thu, 31 Oct 2024 18:44:36 +0100 Subject: [PATCH] fix(mtd): retrieve af even if actors association impossible Commit the retrieval of an acquisition framework to the database before processing the retrieval and association of its actors, i.e. the execution of `associate_actors`. This prevents the retrieval of the AF not be to committed in the case there happen to be issues in the execution of `associate_actors` --- backend/geonature/core/gn_meta/mtd/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/geonature/core/gn_meta/mtd/__init__.py b/backend/geonature/core/gn_meta/mtd/__init__.py index 7364c79ced..156888ef28 100644 --- a/backend/geonature/core/gn_meta/mtd/__init__.py +++ b/backend/geonature/core/gn_meta/mtd/__init__.py @@ -206,6 +206,8 @@ def process_af_and_ds(af_list, ds_list, id_role=None): add_unexisting_digitizer(af["id_digitizer"] if not id_role else id_role) user_add_total_time += time.time() - start_add_user_time af = sync_af(af) + # Commit here to retrieve the AF even if the association of actors that follows is to fail + db.session.commit() # If the AF has not been retrieved, associated actors cannot be retrieved either # and thus we continue to the next AF if not af: