fixed more strats

This commit is contained in:
Milo 2019-04-07 00:04:06 +02:00
parent 64108f67f9
commit b6c414f556

View file

@ -34,6 +34,7 @@ def australiaStrat(context : Context) -> Prediction:
t = datetime.now().astimezone(australia)
hour = t.hour
p = Prediction()
p.weight = 1.0
if hour > 22 or hour < 6:
p.probability = 0.0
@ -54,7 +55,7 @@ def tv2newsStrat(context : Context) -> Prediction:
print('after')
data = r.json()
publish_dates = [(x['pubDate'])//1000 for x in data][:10]
publish_dates = [(x['pubDate'])//1000 for x in data[:5]]
delta_times = []
for i in range(len(publish_dates)):
if i == 0 : continue
@ -69,6 +70,7 @@ def tv2newsStrat(context : Context) -> Prediction:
p.weight = 0.0
else:
p.weight = 0.7
p.probability = 1.0 if avg_timestamp > 50 else 0.0
p.reasons.append('There were ' + ('few' if avg_timestamp > 50 else 'many') + ' recent articles on TV2 News')
print(avg_timestamp)
p.probability = 0.75 if avg_timestamp > 40 else 0.25
p.reasons.append('There were ' + ('few' if avg_timestamp > 40 else 'many') + ' recent articles on TV2 News')
return p