Skip to content

Commit

Permalink
fix: geojson task splitting props in odk collect format
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Feb 26, 2024
1 parent 1a4f6bb commit 2f0291d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/backend/app/db/postgis_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,22 @@ async def split_geojson_by_task_areas(
SELECT
ST_SetSRID(ST_GeomFromGeoJSON(feature->>'geometry'), 4326) AS geometry,
jsonb_set(
jsonb_set(feature->'properties', '{task_id}', to_jsonb(tasks.id), true),
'{project_id}', to_jsonb(tasks.project_id), true
jsonb_set(
jsonb_set(
jsonb_set(
feature->'properties',
'{task_id}', to_jsonb(tasks.id), true
),
'{project_id}', to_jsonb(tasks.project_id), true
),
'{id}', to_jsonb(tasks.id), true
),
'{title}', to_jsonb(CONCAT(
'project_',
:project_id,
'_task_',
tasks.id
)), true
) AS properties
FROM (
SELECT jsonb_array_elements(CAST(:geojson_featcol AS jsonb)->'features')
Expand Down

0 comments on commit 2f0291d

Please sign in to comment.