Skip to content

Commit

Permalink
Merge branch 'development' of github.com:hotosm/fmtm into fix/pass-ad…
Browse files Browse the repository at this point in the history
…ditional-entity-name
  • Loading branch information
NSUWAL123 committed Nov 8, 2024
2 parents ef2589d + 11d5430 commit ce4e82a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
7 changes: 5 additions & 2 deletions nginx/templates/fmtm.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ server {

location /mapnow {
# Serve FMTM mapper frontend under /usr/share/nginx/html
root /usr/share/nginx/html/fmtm/mapper;
try_files $uri $uri/ /index.html;
# NOTE here we use alias instead of root
# to ensure the location part is replaced by the alias part
# i.e. they don't stack as mapnow/mapnow and cause a loop
alias /usr/share/nginx/html/fmtm/mapper;
try_files $uri $uri/ /mapnow/index.html;
}

location / {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/app/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/backend/app/submissions/submission_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -358,6 +358,7 @@ async def upload_attachment_to_s3(
""",
batch_insert_data,
)
db.commit()
return True

except Exception as e:
Expand Down
1 change: 1 addition & 0 deletions src/backend/app/submissions/submission_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ async def submission_table(
project.id,
instance_ids,
background_task_id,
db,
)

if task_id:
Expand Down
17 changes: 17 additions & 0 deletions src/backend/migrations/007-rename-task-history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ END$$;



-- Manually populate states for existing data
UPDATE task_events
SET state = CASE event
WHEN 'MAP' THEN 'LOCKED_FOR_MAPPING'
WHEN 'FINISH' THEN 'UNLOCKED_TO_VALIDATE'
WHEN 'VALIDATE' THEN 'LOCKED_FOR_VALIDATION'
WHEN 'GOOD' THEN 'UNLOCKED_DONE'
WHEN 'BAD' THEN 'UNLOCKED_TO_MAP'
WHEN 'SPLIT' THEN 'UNLOCKED_DONE'
WHEN 'MERGE' THEN 'UNLOCKED_DONE'
WHEN 'ASSIGN' THEN 'LOCKED_FOR_MAPPING'
WHEN 'COMMENT' THEN state -- Preserve the existing state
END;




-- Add task_events foreign keys

DO $$
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/api/CreateProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ const GetDividedTaskFromGeojson = (url: string, projectData: Record<string, any>
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 }));
Expand Down

0 comments on commit ce4e82a

Please sign in to comment.