fixed messages

This commit is contained in:
Alexander Munch-Hansen 2019-04-06 22:29:09 +02:00
parent 0113869d68
commit 8cf08d6719

View file

@ -20,9 +20,8 @@ def is_tide(context: Context) -> Prediction:
month, cur_year_total_cars, last_year_total_cars = determine_month() month, cur_year_total_cars, last_year_total_cars = determine_month()
month = int(month) month = int(month)
p.reasons.append(f"The month is {calendar.month_name[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 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}") 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') 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]) moments.append(time[0])
night = sum([1 for x in moments if 6 >= x.hour or x.hour >= 22]) 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 = 1 - (night / len(moments))
p.probability = night / len(moments)
return p return p