From 396c8480acbf390d848b3157ceeb156188b2b63d Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Sat, 6 Apr 2019 21:02:54 +0200 Subject: [PATCH] bug fixing --- server/nightr/strategies/tide_strat.py | 14 +++++++------- server/nightr/strategies/upstairs_neighbour.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/nightr/strategies/tide_strat.py b/server/nightr/strategies/tide_strat.py index b73f450..f876158 100644 --- a/server/nightr/strategies/tide_strat.py +++ b/server/nightr/strategies/tide_strat.py @@ -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: diff --git a/server/nightr/strategies/upstairs_neighbour.py b/server/nightr/strategies/upstairs_neighbour.py index 63ff206..bfc45fa 100644 --- a/server/nightr/strategies/upstairs_neighbour.py +++ b/server/nightr/strategies/upstairs_neighbour.py @@ -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