From 9e4ecf59c72b4f095449bc83b62477c3deb677e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 21 Nov 2023 16:20:56 +0100 Subject: [PATCH] Fix input paths. Include losses in table. --- endgames.py | 4 ++-- get_sheet.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/endgames.py b/endgames.py index 1437fa0..db49f7d 100644 --- a/endgames.py +++ b/endgames.py @@ -78,7 +78,7 @@ def full_analyze_game_cached(game_id: int, strategy: Optional[str] = None): cached = DATA.get(key, {}).get(str(game_id), None) if cached is not None: return cached - result = full_analyze_game(str(GAMES_PATH / str(game_id)) + '-{}'.format(strategy) if strategy is not None else '') + result = full_analyze_game(str(GAMES_PATH / str(game_id)) + ('-{}'.format(strategy) if strategy is not None else '')) if key not in DATA.keys(): DATA[key] = {} DATA[key][game_id] = result @@ -93,7 +93,7 @@ def analyze_game_cached(game_id: int, strategy: Optional[str] = None): cached = DATA.get(key, {}).get(str(game_id), None) if cached is not None: return cached - result = analyze_game(str(GAMES_PATH / str(game_id)) + '-{}'.format(strategy) if strategy is not None else '') + result = analyze_game(str(GAMES_PATH / str(game_id)) + ('-{}'.format(strategy) if strategy is not None else '')) if key not in DATA.keys(): DATA[key] = {} DATA[key][game_id] = result diff --git a/get_sheet.py b/get_sheet.py index c410da8..ebd11c1 100644 --- a/get_sheet.py +++ b/get_sheet.py @@ -259,6 +259,7 @@ def make_team_table(games, analysis): 'Games': 0, 'BDR': 0, 'Win': 0, + 'Loss': 0, 'Discard crit': 0, 'Bomb crit': 0, 'Strikeout': 0, @@ -271,12 +272,13 @@ def make_team_table(games, analysis): if entry.won: stats[num_p][key]['Win'] += 1 else: + stats[num_p][key]['Loss'] += 1 stats[num_p][key][termination] += 1 for num_p in range(3, 6): filename = Path('out/teams_{}.csv'.format(num_p)) with open(filename, 'w') as f: - writer = csv.DictWriter(f, fieldnames=['Team', 'Games', 'Win', 'BDR', 'Discard crit', 'Bomb crit', 'Strikeout', 'VTK', 'Lost Endgame']) + writer = csv.DictWriter(f, fieldnames=['Team', 'Games', 'Win', 'Loss', 'BDR', 'Discard crit', 'Bomb crit', 'Strikeout', 'VTK', 'Lost Endgame']) writer.writeheader() for team, row in sorted(stats[num_p].items(), key=lambda item: -item[1]['Games']): row['Team'] = team