From 7382974aea59fca69163f8d3a09097f12b22f478 Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Thu, 13 Feb 2025 12:36:59 +0700 Subject: [PATCH] add id --- src/calculation_time_constrains/service.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calculation_time_constrains/service.py b/src/calculation_time_constrains/service.py index ff7b930..3204b1e 100644 --- a/src/calculation_time_constrains/service.py +++ b/src/calculation_time_constrains/service.py @@ -94,6 +94,7 @@ async def get_corrective_cost_time_chart( # Fill in missing dates with nearest available value complete_data = [] last_known_value = 0 # Default value if no data is available + not_full_data = [] for date in date_range: if date in data_dict: @@ -101,16 +102,16 @@ async def get_corrective_cost_time_chart( last_known_value = data_dict[date] complete_data.append(last_known_value) else: + not_full_data.append(location_tag) complete_data.append(0) - # Convert to numpy array daily_failure = np.array(complete_data) - failure_counts = np.cumsum(daily_failure) + # failure_counts = np.cumsum(daily_failure) # Calculate corrective costs cost_per_failure = material_cost + service_cost - corrective_costs = failure_counts * cost_per_failure + corrective_costs = daily_failure * cost_per_failure return corrective_costs, daily_failure