bug fixing

This commit is contained in:
Alexander Munch-Hansen 2019-04-06 21:02:54 +02:00
parent d60f74e496
commit 396c8480ac
2 changed files with 8 additions and 8 deletions

View File

@ -19,9 +19,9 @@ def is_tide(context: Context) -> Prediction:
month, cur_year_total_cars, last_year_total_cars = determine_month()
month = int(month)
p.reasons.append(f"Because the month is f{calendar.month_name[month]}")
p.reasons.append(f"Because the number of cars having driven on the Storbæltsbro is f{cur_year_total_cars}")
p.reasons.append(f"And because the number of cars having driven over it in the last year is f{last_year_total_cars}")
p.reasons.append(f"The month is {calendar.month_name[month]}")
p.reasons.append(f"The number of cars having driven on the Storbæltsbro is {cur_year_total_cars}")
p.reasons.append(f"The number of cars having driven over it in the last year is {last_year_total_cars}")
@ -47,27 +47,27 @@ def is_tide(context: Context) -> Prediction:
average_delta = timedelta(seconds=average_inc)
if last_match[1] < 0 and last_match[1] < current_water_level: # Increasing
if last_match[1] < 0 and last_match[1] <= current_water_level: # Increasing
time = last_match
while time[1] != current_water_level:
time[0] += average_delta
time[1] += 1
elif last_match[1] < 0 and last_match[1] > current_water_level:
elif last_match[1] < 0 and last_match[1] >= current_water_level:
time = last_match
while time[1] != current_water_level:
time[0] += average_delta
time[1] -= 1
elif last_match[1] > 0 and last_match[1] > current_water_level: # Decreasing
elif last_match[1] > 0 and last_match[1] >= current_water_level: # Decreasing
time = last_match
while time[1] != current_water_level:
time[0] += average_delta
time[1] -= 1
elif last_match[1] > 0 and last_match[1] < current_water_level:
elif last_match[1] > 0 and last_match[1] <= current_water_level:
time = last_match
while time[1] != current_water_level:

View File

@ -34,7 +34,7 @@ def check_games(context: Context) -> Prediction:
else:
last_game_in_hours = min(24.0, last_game_in_hours)
p.reasons.append(f"Alexanders upstairs neighbour has not played league for {last_game_in_hours} hours!")
p.reasons.append(f"Alexanders upstairs neighbour has not played league for {last_game_in_hours:.2f} hours!")
p.probability = 1 - (last_game_in_hours / 24)
return p