Skip to content

Commit

Permalink
adds treatment rank to other modes
Browse files Browse the repository at this point in the history
  • Loading branch information
george-silva committed Dec 23, 2024
1 parent 4b79279 commit 0c03728
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/planscape/planning/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def feature_to_project_area(user_id: int, scenario, feature, idx: Optional[int]
"name": area_name,
"created_by": user_id,
"scenario": scenario,
"data": idx,
}
proj_area_obj = ProjectArea.objects.create(**project_area)

Expand Down Expand Up @@ -194,10 +195,14 @@ def create_scenario_from_upload(validated_data, user) -> Scenario:
# handle just one polygon
if "type" in uploaded_geom and uploaded_geom["type"] == "Polygon":
new_feature = feature_to_project_area(
scenario.user, scenario, json.dumps(uploaded_geom)
scenario.user,
scenario,
json.dumps(uploaded_geom),
1,
)
uploaded_geom.setdefault("properties", {})
uploaded_geom["properties"]["project_id"] = new_feature.pk
uploaded_geom["properties"]["treatment_rank"] = 1

# handle a FeatureCollection
if "features" in uploaded_geom:
Expand Down

0 comments on commit 0c03728

Please sign in to comment.