diff options
author | emkael <emkael@tlen.pl> | 2022-03-12 20:32:18 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2022-03-12 20:32:18 +0100 |
commit | 9ea9dba5dba306730e3fbdd3815c26f551032566 (patch) | |
tree | 73be05e7544c2ccf2b72c1fb4cb9ac128ecd4cd4 /jfr_playoff/data/tournament/jfrhtml.py | |
parent | 75be33331c1953493ade099b9657eb6ee5f088a7 (diff) |
Scores for carry-over purposes in team lists
Diffstat (limited to 'jfr_playoff/data/tournament/jfrhtml.py')
-rw-r--r-- | jfr_playoff/data/tournament/jfrhtml.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/jfr_playoff/data/tournament/jfrhtml.py b/jfr_playoff/data/tournament/jfrhtml.py index ac57d4c..f42595a 100644 --- a/jfr_playoff/data/tournament/jfrhtml.py +++ b/jfr_playoff/data/tournament/jfrhtml.py @@ -1,3 +1,4 @@ +from decimal import Decimal from math import ceil import re @@ -79,6 +80,21 @@ class JFRHtmlTournamentInfo(TournamentInfoClient): team_image = team.find('img') if team_image is not None: team_info.append(team_image['src'].replace('images/', '')) + else: + team_info.append(None) + # make room for final positionswhich would otherwise be defined in config + team_info.append(None) + # fetch score for carry-over purposes + score_td = team + while score_td is not None and score_td.name != 'td': + score_td = score_td.parent + if score_td is None: + PlayoffLogger.get('tournament.jfrhtml').info( + 'something went wrong, could not find parent cell table for team: %s', team_info) + score_td = score_td.find_next_sibling('td', class_='bdc') + PlayoffLogger.get('tournament.jfrhtml').debug( + 'score cell for team: %s', score_td) + team_info.append(Decimal(score_td.text.strip())) teams.append(team_info) PlayoffLogger.get('tournament.jfrhtml').info( 'read tournament results from leaderboard: %s', teams) |