fixed more strats
This commit is contained in:
parent
64108f67f9
commit
b6c414f556
|
@ -34,6 +34,7 @@ def australiaStrat(context : Context) -> Prediction:
|
||||||
t = datetime.now().astimezone(australia)
|
t = datetime.now().astimezone(australia)
|
||||||
hour = t.hour
|
hour = t.hour
|
||||||
p = Prediction()
|
p = Prediction()
|
||||||
|
p.weight = 1.0
|
||||||
|
|
||||||
if hour > 22 or hour < 6:
|
if hour > 22 or hour < 6:
|
||||||
p.probability = 0.0
|
p.probability = 0.0
|
||||||
|
@ -54,7 +55,7 @@ def tv2newsStrat(context : Context) -> Prediction:
|
||||||
print('after')
|
print('after')
|
||||||
|
|
||||||
data = r.json()
|
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 = []
|
delta_times = []
|
||||||
for i in range(len(publish_dates)):
|
for i in range(len(publish_dates)):
|
||||||
if i == 0 : continue
|
if i == 0 : continue
|
||||||
|
@ -69,6 +70,7 @@ def tv2newsStrat(context : Context) -> Prediction:
|
||||||
p.weight = 0.0
|
p.weight = 0.0
|
||||||
else:
|
else:
|
||||||
p.weight = 0.7
|
p.weight = 0.7
|
||||||
p.probability = 1.0 if avg_timestamp > 50 else 0.0
|
print(avg_timestamp)
|
||||||
p.reasons.append('There were ' + ('few' if avg_timestamp > 50 else 'many') + ' recent articles on TV2 News')
|
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
|
return p
|
||||||
|
|
Loading…
Reference in New Issue
Block a user