From 3113c57b54474d5a0a71c83c4c46813d6a26759a Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 27 Jan 2018 15:22:23 +0100 Subject: Score defined in JSON overrides any score from database Closes #3 --- jfr_playoff/data.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'jfr_playoff') diff --git a/jfr_playoff/data.py b/jfr_playoff/data.py index 6a58ee6..cb45fc3 100644 --- a/jfr_playoff/data.py +++ b/jfr_playoff/data.py @@ -143,9 +143,6 @@ class PlayoffData(object): else '??' for team in match_teams]) else: teams[i].name = '' - if 'score' in match: - for i in range(0, 2): - teams[i].score = match['score'][i] return teams def get_match_info(self, match): @@ -166,8 +163,10 @@ class PlayoffData(object): info.teams = self.get_db_match_teams(match) except (mysql.connector.Error, TypeError, IndexError): info.teams = self.get_config_match_teams(match) - if (info.teams[0].score != 0) or (info.teams[1].score != 0): - info.running = -1 + if 'score' in match: + for i in range(0, 2): + info.teams[i].score = match['score'][i] + info.running = -1 try: towels = self.database.fetch( match['database'], p_sql.TOWEL_COUNT, -- cgit v1.2.3