Skip to content

Commit

Permalink
fix:merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Sep 28, 2023
2 parents 3167eba + ac5044c commit 799c915
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 321 deletions.
11 changes: 4 additions & 7 deletions src/backend/app/central/central_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,20 +636,18 @@ def create_odk_xform_for_janakpur(

if result != 200 and result != 409:
return result
data = f"/tmp/{title}.geojson"

# This modifies an existing published XForm to be in draft mode.
# An XForm must be in draft mode to upload an attachment.
if upload_media:

# Upload buildings file
# Upload buildings file
building_file = f"/tmp/buildings_{title}.geojson"

result = xform.uploadMedia(
project_id, title, building_file, convert_to_draft_when_publishing
)

# Upload roads file
# Upload roads file
road_file = f"/tmp/roads_{title}.geojson"
result = xform.uploadMedia(
project_id, title, road_file, convert_to_draft_when_publishing
Expand All @@ -659,7 +657,6 @@ def create_odk_xform_for_janakpur(
return result



def generate_updated_xform_for_janakpur(
xlsform: str,
xform: str,
Expand Down Expand Up @@ -716,11 +713,11 @@ def generate_updated_xform_for_janakpur(
try:
if "src" in inst.attrib:
print("SRC = Present")
if (inst.attrib["src"]) == "jr://file/buildings.geojson": #FIXME
if (inst.attrib["src"]) == "jr://file/buildings.geojson": # FIXME
print("INST attribs = ", inst.attrib["src"])
inst.attrib["src"] = buildings_extract

if (inst.attrib["src"]) == "jr://file/roads.geojson": #FIXME
if (inst.attrib["src"]) == "jr://file/roads.geojson": # FIXME
inst.attrib["src"] = roads_extract

# Looking for data tags
Expand Down
12 changes: 5 additions & 7 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,6 @@ def update_multi_polygon_project_boundary(
# To be used in lambda, to remove z dimension from
# each coordinate in the feature's geometry.
# """
# print("COord = ", coord)
# print('length of coord = ',len(coord))
# return coord.pop() if len(coord) == 3 else None

# # Apply the lambda function to each coordinate in its geometry
Expand Down Expand Up @@ -1171,7 +1169,10 @@ def upload_custom_data_extracts(
properties = flatten_dict(feature["properties"])

db_feature = db_models.DbFeatures(
project_id=project_id, geometry=wkb_element, properties=properties, category_title=category
project_id=project_id,
geometry=wkb_element,
properties=properties,
category_title=category,
)
db.add(db_feature)
db.commit()
Expand Down Expand Up @@ -2453,7 +2454,6 @@ def generate_appuser_files_for_janakpur(
project_obj = get_project(db, project_id)

for task_id in tasks_list:

# Generate taskFiles
name = f"{project_name}_{category}_{task_id}"

Expand Down Expand Up @@ -2481,8 +2481,6 @@ def generate_appuser_files_for_janakpur(

# This file will store xml contents of an xls form.
xform = f"/tmp/{name}.xml"

print("XFORM = ", xform)

buildings_extracts = f"/tmp/buildings_{name}.geojson" # This file will store osm extracts
roads_extracts = f"/tmp/roads_{name}.geojson" # This file will store osm extracts
Expand Down Expand Up @@ -2540,7 +2538,7 @@ def generate_appuser_files_for_janakpur(
'properties', properties
) AS feature
FROM features
WHERE project_id={project_id}
WHERE project_id={project_id} and task_id={task_id} and category_title='highways'
) features;"""
)
highway_result = db.execute(highway_query)
Expand Down
7 changes: 2 additions & 5 deletions src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,6 @@ async def project_centroid(
return result_dict_list



@router.post("/{project_id}/generate_files_for_janakpur")
async def generate_files_janakpur(
background_tasks: BackgroundTasks,
Expand All @@ -1067,10 +1066,8 @@ async def generate_files_janakpur(
roads_file: UploadFile,
form: UploadFile,
db: Session = Depends(database.get_db),
):
"""
Generate required media files tasks in the project based on the provided params.
"""
):
"""Generate required media files tasks in the project based on the provided params."""
log.debug(f"Generating media files tasks for project: {project_id}")
xform_title = None

Expand Down
Loading

0 comments on commit 799c915

Please sign in to comment.