Closed lpofredc closed 1 year ago
It is not going to be an easy modification. forms_data is built during the loop on all items in the dict and date_start, date_stop are computed across all sightings in the form.
I would have to store each sighting in a temporary list, create the form with all its attributes, and then store observations/sightings from this list. Is this what you expect ?
Ok, i added a new trigger on forms_json to trigger observation upsert after form insert or update.
This process is currently problematic if you want to perform triggers on form data as it is currently the case for vigie-nature protocol data. It would be preferable to firstly record the form and then the data from the form.
https://github.com/dthonon/Client_API_VN/blob/a42180f45f7713bc36ed601a6f4694260867612e/src/export_vn/store_postgresql.py#L1046-L1080