From a529a7238832b6ce1353a7e0b6cbf57f5fb8adda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 26 Dec 2023 17:23:53 +0100 Subject: [PATCH] add cli to refresh all games --- hanabi-league | 5 +++-- src/fetch_games.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hanabi-league b/hanabi-league index cf0a332..0784af4 100755 --- a/hanabi-league +++ b/hanabi-league @@ -49,14 +49,14 @@ def subcommand_generate_config(): config.create_config() -def subcommand_fetch(target: str): +def subcommand_fetch(target: str, refresh: bool = False): if target in ["all", "players"]: fetch_players.fetch_players_interactive() if target in ["all", "games"]: games = fetch_games.fetch_games_for_all_players() fetch_games.store_new_games(games) if target in ["all", "game-details"]: - fetch_games.fetch_all_game_details() + fetch_games.fetch_all_game_details(refresh) def subcommand_process_ratings(): @@ -105,6 +105,7 @@ def get_parser() -> argparse.ArgumentParser: fetch_parser = subparsers.add_parser('fetch', help='Fetch new data.') fetch_parser.add_argument(dest='target', choices=['all', 'players', 'games', 'game-details'], default='all') + fetch_parser.add_argument('--refresh', action='store_true') return parser diff --git a/src/fetch_games.py b/src/fetch_games.py index ac4fd37..b0168f4 100644 --- a/src/fetch_games.py +++ b/src/fetch_games.py @@ -111,7 +111,7 @@ def fetch_games_for_all_players() -> List[GameInfo]: "FROM user_accounts " "LEFT OUTER JOIN downloads " " ON user_accounts.normalized_username = downloads.normalized_username", - (config_manager.get_config().starting_game_id,) + (config_manager.get_config().starting_game_id - 1,) ) # This will be a mapping of game id -> JSON data that we get from hanab.live, where we will collect all the