Skip to content

Commit 0e80610

Browse files
committed
Merge branch 'main' into COPDS-2006-format-api-request
2 parents 75030a9 + 9ec2197 commit 0e80610

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cads_processing_api_service/costing.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def estimate_cost(
6565
request.get("inputs", {}), adaptor_properties, request_origin
6666
)
6767
cost = costing.compute_highest_cost_limit_ratio(costing_info)
68+
if costing_info.cost_bar_steps:
69+
cost.cost_bar_steps = costing_info.cost_bar_steps
6870
return cost
6971

7072

@@ -128,5 +130,8 @@ def compute_costing(
128130
)
129131
costing_config: dict[str, Any] = adaptor_properties["config"].get("costing", {})
130132
limits: dict[str, Any] = costing_config.get("max_costs", {})
131-
costing_info = models.CostingInfo(costs=costs, limits=limits)
133+
cost_bar_steps = costing_config.get("cost_bar_steps", None)
134+
costing_info = models.CostingInfo(
135+
costs=costs, limits=limits, cost_bar_steps=cost_bar_steps
136+
)
132137
return costing_info

cads_processing_api_service/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@ class Exception(ogc_api_processes_fastapi.models.Exception):
7070
class CostingInfo(pydantic.BaseModel):
7171
costs: dict[str, float] = {}
7272
limits: dict[str, float] = {}
73+
cost_bar_steps: list[int] | None = None
7374

7475

7576
class RequestCost(pydantic.BaseModel):
7677
id: str | None = None
7778
cost: float = 0.0
7879
limit: float = 1.0
80+
cost_bar_steps: list[int] | None = None
7981

8082

8183
class Execute(ogc_api_processes_fastapi.models.Execute):

0 commit comments

Comments
 (0)