diff options
author | emkael <emkael@tlen.pl> | 2024-02-12 19:10:20 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2024-02-12 19:10:20 +0100 |
commit | f5997f1e14a2acc14a78f690ecd5d90ee501ceff (patch) | |
tree | 63741942755003a1dfba758a76a515f40602ec7a /jfr_playoff/data/match/jfrhtml.py | |
parent | 0f95c0799a7efbeaf64051930a857c3cd9effc5c (diff) |
If JFR webpage segment is not explicitly running, still count real number of boards "played" (visible in the scoresheet) in it.v2.2
This is so that when something's wrong (like, a board is erroneously hidden) only that board is not counted, and not the entire segment.
Diffstat (limited to 'jfr_playoff/data/match/jfrhtml.py')
-rw-r--r-- | jfr_playoff/data/match/jfrhtml.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/jfr_playoff/data/match/jfrhtml.py b/jfr_playoff/data/match/jfrhtml.py index a869811..5285a8a 100644 --- a/jfr_playoff/data/match/jfrhtml.py +++ b/jfr_playoff/data/match/jfrhtml.py @@ -129,13 +129,13 @@ class JFRHtmlMatchInfo(MatchInfoClient): PlayoffLogger.get('match.jfrhtml').info( 'HTML played boards count for segment: %d/%d', played_boards, board_count) - return board_count, played_boards >= board_count + return board_count, played_boards except IOError as e: PlayoffLogger.get('match.jfrhtml').info( 'cannot fetch played boards count for segment: %s(%s)', type(e).__name__, str(e)) - return 0, False - return 0, False + return 0, 0 + return 0, 0 def board_count(self): row = self._find_table_row(self.settings['link']) @@ -166,9 +166,12 @@ class JFRHtmlMatchInfo(MatchInfoClient): in running_segments]) finished_segments = [] boards_in_segment = None + played_boards = 0 for segment in segments: if segment not in running_segments: - boards, is_finished = self._get_finished_info(segment) + boards, played = self._get_finished_info(segment) + is_finished = played >= boards + played_boards += played if is_finished: finished_segments.append(segment) if boards_in_segment is None and boards > 0: @@ -186,9 +189,7 @@ class JFRHtmlMatchInfo(MatchInfoClient): total_boards = ( len(segments) + len(towels) + len(running_segments)) \ * boards_in_segment - played_boards = (len(towels) + len(finished_segments)) \ - * boards_in_segment \ - + running_boards + played_boards += running_boards PlayoffLogger.get('match.jfrhtml').info( 'board count: %d/%d', played_boards, total_boards) return played_boards, total_boards |