Skip to content

Commit

Permalink
fix(mtd): fix return of sync_af function
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentCauchois authored and jacquesfize committed Jun 4, 2024
1 parent ce6903a commit 911e000
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/geonature/core/gn_meta/mtd/mtd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,20 @@ def sync_af(af):
statement = (
update(TAcquisitionFramework)
.where(TAcquisitionFramework.unique_acquisition_framework_id == af_uuid)
.values(af)
.returning(TAcquisitionFramework)
.values(**af)
)
if not af_exists:
statement = (
pg_insert(TAcquisitionFramework)
.values(**af)
.on_conflict_do_nothing(index_elements=["unique_acquisition_framework_id"])
.returning(TAcquisitionFramework)
)
DB.session.execute(statement)

acquisition_framework = DB.session.scalars(
select(TAcquisitionFramework).filter_by(unique_acquisition_framework_id=af_uuid)
)
).first()

return acquisition_framework


Expand Down

0 comments on commit 911e000

Please sign in to comment.