From 8cf08d67193e17a5bf6fd915796698a0bb50b8af Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Sat, 6 Apr 2019 22:29:09 +0200 Subject: [PATCH] fixed messages --- server/nightr/strategies/tide_strat.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server/nightr/strategies/tide_strat.py b/server/nightr/strategies/tide_strat.py index f876158..471ca2b 100644 --- a/server/nightr/strategies/tide_strat.py +++ b/server/nightr/strategies/tide_strat.py @@ -20,9 +20,8 @@ def is_tide(context: Context) -> Prediction: month, cur_year_total_cars, last_year_total_cars = determine_month() month = int(month) 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}") - + p.reasons.append(f"The number of cars having driven on the Storbæltsbro is {cur_year_total_cars}, in the current year") + p.reasons.append(f"The number of cars having driven over it in the last year is {last_year_total_cars}, thus the frequency is: {last_year_total_cars / cur_year_total_cars}") tide_data = requests.get('https://www.dmi.dk/fileadmin/user_upload/Bruger_upload/Tidevand/2019/Aarhus.t.txt') @@ -78,9 +77,9 @@ def is_tide(context: Context) -> Prediction: moments.append(time[0]) night = sum([1 for x in moments if 6 >= x.hour or x.hour >= 22]) + p.reasons.append(f"The water level is currently at {current_water_level}") + p.reasons.append(f"The number of times the water is at the current level at nighttime is: {night}, compared to the total amount of times in {calendar.month_name[month]}, being {len(moments)}") - p.reasons.append(f"And because the number of times the water is at the current level at nighttime is: {night}, compared to the total amount of times in {calendar.month_name[month]}, being {len(moments)}") - - p.probability = night / len(moments) + p.probability = 1 - (night / len(moments)) return p