From 0c0372813d17d29a9bef6d264e139c83c6768974 Mon Sep 17 00:00:00 2001 From: George Silva Date: Mon, 23 Dec 2024 14:35:29 -0300 Subject: [PATCH] adds treatment rank to other modes --- src/planscape/planning/services.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/planscape/planning/services.py b/src/planscape/planning/services.py index 78e1a2263..46bcd076f 100644 --- a/src/planscape/planning/services.py +++ b/src/planscape/planning/services.py @@ -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) @@ -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: