diff --git a/src/backend/app/db/models.py b/src/backend/app/db/models.py index 5273974445..4c64afa5fc 100644 --- a/src/backend/app/db/models.py +++ b/src/backend/app/db/models.py @@ -1620,7 +1620,7 @@ class DbSubmissionPhoto(BaseModel): TODO SQL this will be replace by ODK Central direct S3 upload. """ - id: int + id: Optional[int] = None project_id: Optional[int] = None task_id: Optional[int] = None # Note this is not a DbTask, but an ODK task_id submission_id: Optional[str] = None diff --git a/src/backend/app/submissions/submission_crud.py b/src/backend/app/submissions/submission_crud.py index ab571ce19d..56bcf6a996 100644 --- a/src/backend/app/submissions/submission_crud.py +++ b/src/backend/app/submissions/submission_crud.py @@ -344,7 +344,7 @@ async def upload_attachment_to_s3( # Perform batch insert if there are new records to insert async with db.cursor() as cur: - await cur.execute( + await cur.executemany( # executes multiple inserts (batch insert) """ INSERT INTO submission_photos ( project_id, @@ -358,6 +358,7 @@ async def upload_attachment_to_s3( """, batch_insert_data, ) + db.commit() return True except Exception as e: diff --git a/src/backend/app/submissions/submission_routes.py b/src/backend/app/submissions/submission_routes.py index d2a65df633..ab322fc15f 100644 --- a/src/backend/app/submissions/submission_routes.py +++ b/src/backend/app/submissions/submission_routes.py @@ -321,6 +321,7 @@ async def submission_table( project.id, instance_ids, background_task_id, + db, ) if task_id: diff --git a/src/frontend/src/api/CreateProjectService.ts b/src/frontend/src/api/CreateProjectService.ts index 9f9748f764..a6ea36d25e 100755 --- a/src/frontend/src/api/CreateProjectService.ts +++ b/src/frontend/src/api/CreateProjectService.ts @@ -292,7 +292,7 @@ const GetDividedTaskFromGeojson = (url: string, projectData: Record try { const dividedTaskFormData = new FormData(); dividedTaskFormData.append('project_geojson', projectData.geojson); - dividedTaskFormData.append('dimension', projectData.dimension); + dividedTaskFormData.append('dimension_meters', projectData.dimension); const getGetDividedTaskFromGeojsonResponse = await axios.post(url, dividedTaskFormData); const resp: OrganisationListModel = getGetDividedTaskFromGeojsonResponse.data; dispatch(CreateProjectActions.SetIsTasksGenerated({ key: 'divide_on_square', value: true }));