This commit is contained in:
kramo
2023-04-17 22:32:28 +02:00
parent bc0d33f966
commit 741245b415
5 changed files with 35 additions and 72 deletions

View File

@@ -326,7 +326,7 @@ def create_details_window(win, game_id=None):
path = win.games_dir / f"{game_id}.json"
if path.exists():
data = json.loads(path.read_text("utf-8"))
data = json.load(path.open())
data.update(values)
save_game(win, data)
else:

View File

@@ -26,13 +26,14 @@ def get_games(win, game_ids=None):
if not win.games_dir.exists():
return {}
if game_ids:
game_files = [win.games_dir / f"{game_id}.json" for game_id in game_ids]
else:
game_files = win.games_dir.iterdir()
game_files = (
[win.games_dir / f"{game_id}.json" for game_id in game_ids]
if game_ids
else win.games_dir.iterdir()
)
for game in game_files:
data = json.loads(game.read_text("utf-8"))
for open_file in game_files:
data = json.load(open_file.open())
games[data["game_id"]] = data
return games