diff options
author | emkael <emkael@tlen.pl> | 2018-09-28 14:32:23 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-09-28 14:32:23 +0200 |
commit | e23ef3b9dc245d134e4b0105e2dca7a1833f1ba5 (patch) | |
tree | 86cb9b2bdc858e046e76900c90c187c764cc7846 /jfr_playoff | |
parent | cb1edf3fb102f347adde2a1c8aec205c24cd36be (diff) |
Fixing overall bourd count fetch for a single-segment match
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/matchinfo.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/jfr_playoff/matchinfo.py b/jfr_playoff/matchinfo.py index d968a34..900c210 100644 --- a/jfr_playoff/matchinfo.py +++ b/jfr_playoff/matchinfo.py @@ -292,7 +292,6 @@ class MatchInfo: if len(segments) == 0: raise ValueError('segments not found') running_segments = row.select('td.bdca') - # FIXME: running single-segment match board count running_boards = sum([self.__get_html_running_boards(segment) for segment in running_segments]) finished_segments = [] boards_in_segment = None @@ -303,10 +302,14 @@ class MatchInfo: finished_segments.append(segment) if boards_in_segment is None and boards > 0: boards_in_segment = boards - PlayoffLogger.get('matchinfo').info( - 'HTML board count for match #%d, found: %d finished segments, %d towels, %d boards per segment and %d boards in running segment', - self.info.id, len(finished_segments), len(towels), boards_in_segment, running_boards) - total_boards = (len(segments) + len(towels) + len(running_segments)) * boards_in_segment + if 'bdcg' in segments[0]['class']: + # only a single-segment match will yield td.bdcg cells with segment scores + total_boards = boards_in_segment + else: + PlayoffLogger.get('matchinfo').info( + 'HTML board count for match #%d, found: %d finished segments, %d towels, %d boards per segment and %d boards in running segment', + self.info.id, len(finished_segments), len(towels), boards_in_segment, running_boards) + total_boards = (len(segments) + len(towels) + len(running_segments)) * boards_in_segment played_boards = (len(towels) + len(finished_segments)) * boards_in_segment + running_boards PlayoffLogger.get('matchinfo').info( 'HTML board count for match #%d: %d/%d', |