summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2024-02-14 10:23:27 +0100
committeremkael <emkael@tlen.pl>2024-02-14 10:23:27 +0100
commitbf166b0533cd527e1d9665ad6efc6d11d0e3a27e (patch)
tree2461a4e1fbc382f2c605c74cb06f960b1dd11b84
parent1f8bc9d4faf8c3be01303805c3029835555a676a (diff)
Auto-detecting how home and away team results are represented in TC JSON
-rw-r--r--jfr_playoff/data/match/tcjson.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/jfr_playoff/data/match/tcjson.py b/jfr_playoff/data/match/tcjson.py
index 41ee4d8..590f27d 100644
--- a/jfr_playoff/data/match/tcjson.py
+++ b/jfr_playoff/data/match/tcjson.py
@@ -49,7 +49,8 @@ class TCJsonMatchInfo(MatchInfoClient):
def fetch_teams(self, teams):
results = self._get_results(
self.settings['link'], self.settings['table'])
- for idx, side in enumerate(['Ns', 'Ew']):
+ sides = [side for side in ['Ns', 'Sn', 'We', 'Ew'] if side in results]
+ for idx, side in enumerate(sides):
teams[idx].name = [results[side]['_name']]
teams[idx].known_teams = 1
teams[idx].score = results['Sum1'+side]