feature/reliability_stat
Cizz22 11 months ago
parent 13c6694228
commit 7382974aea

@ -94,6 +94,7 @@ async def get_corrective_cost_time_chart(
# Fill in missing dates with nearest available value # Fill in missing dates with nearest available value
complete_data = [] complete_data = []
last_known_value = 0 # Default value if no data is available last_known_value = 0 # Default value if no data is available
not_full_data = []
for date in date_range: for date in date_range:
if date in data_dict: if date in data_dict:
@ -101,16 +102,16 @@ async def get_corrective_cost_time_chart(
last_known_value = data_dict[date] last_known_value = data_dict[date]
complete_data.append(last_known_value) complete_data.append(last_known_value)
else: else:
not_full_data.append(location_tag)
complete_data.append(0) complete_data.append(0)
# Convert to numpy array # Convert to numpy array
daily_failure = np.array(complete_data) daily_failure = np.array(complete_data)
failure_counts = np.cumsum(daily_failure) # failure_counts = np.cumsum(daily_failure)
# Calculate corrective costs # Calculate corrective costs
cost_per_failure = material_cost + service_cost 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 return corrective_costs, daily_failure

Loading…
Cancel
Save