Skip to content

Commit

Permalink
Background: Proper fix for PlayerGameResult
Browse files Browse the repository at this point in the history
Game name format can vary. For game n in round m, we may have
"R m B n" or "m / n".
Change the code to support either.
  • Loading branch information
UEWBot committed Feb 4, 2025
1 parent 8a45e55 commit eb43ea5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions visualiser/tournament/players.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,14 +1227,19 @@ def for_same_game(self, pgr):
def round(self):
"""Which round of the tournament was the game played?"""
# Parse the game name
# Format is either "R n B m" or "n / m"
parts = self.game_name.split()
return parts[1]
if (len(parts) == 4) and (parts[0] == 'R') and (parts[2] == 'B'):
return parts[1]
elif (len(parts) == 3) and (parts[1] == '/'):
return parts[0]
return '?'

def board(self):
"""Which board of the round was the game?"""
# Parse the game name
parts = self.game_name.split()
return parts[2]
# Format is either "R n B m" or "n / m"
return parts[-1]

def wdd_url(self):
"""WDD URL where this result can be seen"""
Expand Down

0 comments on commit eb43ea5

Please sign in to comment.