diff --git a/src/calculation_time_constrains/service.py b/src/calculation_time_constrains/service.py index ab85cae..1edc105 100644 --- a/src/calculation_time_constrains/service.py +++ b/src/calculation_time_constrains/service.py @@ -123,7 +123,7 @@ class ReliabilityService: random.seed(hash(location_tag) % 1000) # Base parameters for realistic failure patterns - base_monthly_failures = random.uniform(0.25, 1.25) # Base failures per month + base_monthly_failures = random.uniform(0.05, 0.5) # Base failures per month seasonal_amplitude = random.uniform(0.3, 0.8) # Seasonal variation strength trend_slope = random.uniform(-0.01, 0.02) # Long-term trend (slight increase over time) noise_level = random.uniform(0.1, 0.3) # Random variation @@ -135,9 +135,15 @@ class ReliabilityService: month_count = 0 for _ in range(max_interval): + #If month count == 0, set cumulative_failures to 0 last_day = calendar.monthrange(current.year, current.month)[1] last_day_date = datetime.datetime(current.year, current.month, last_day) + if month_count == 0: + cumulative_failures = 0 + results[last_day_date] = round(cumulative_failures, 3) + continue + # Stop if we've passed the end_date if last_day_date > end_date: break