Skip to content

Commit

Permalink
fix(mtd): make sync_af return actual af model and not int
Browse files Browse the repository at this point in the history
Modify the function `sync_af` so that it returns
the actual acquisition framework ; an instance of
the model `TAcquisitionFramework` ; rather than
an integer.

This, in turn, fixes the function
`process_af_and_ds` and fixes MTD synchronization.
  • Loading branch information
VincentCauchois authored and jacquesfize committed May 27, 2024
1 parent 6c03999 commit 6e63d1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/geonature/core/gn_meta/mtd/mtd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ def sync_af(af):
.on_conflict_do_nothing(index_elements=["unique_acquisition_framework_id"])
.returning(TAcquisitionFramework)
)
DB.session.execute(statement)

return DB.session.scalar(statement)
acquisition_framework = DB.session.scalars(
select(TAcquisitionFramework).filter_by(unique_acquisition_framework_id=af_uuid)
)
return acquisition_framework


def add_or_update_organism(uuid, nom, email):
Expand Down

0 comments on commit 6e63d1b

Please sign in to comment.