From b6c414f556f9bbbeb4553a9c09550d795bce8bcc Mon Sep 17 00:00:00 2001 From: Milo Date: Sun, 7 Apr 2019 00:04:06 +0200 Subject: [PATCH] fixed more strats --- server/nightr/strategies/miloStrats.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/nightr/strategies/miloStrats.py b/server/nightr/strategies/miloStrats.py index 0b51e43..9ac03b5 100644 --- a/server/nightr/strategies/miloStrats.py +++ b/server/nightr/strategies/miloStrats.py @@ -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