From bc647e234bbc91cd47b9d8aebc4a06fcf1562b6b Mon Sep 17 00:00:00 2001 From: Evgeniy Kozlov Date: Fri, 25 Oct 2024 13:22:31 +0300 Subject: [PATCH] tools: tu-deck-grabber: fixed setDeckCards for empty deck --- tools/tu-deck-grabber.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/tu-deck-grabber.py b/tools/tu-deck-grabber.py index 829c9bbd..812eea7c 100755 --- a/tools/tu-deck-grabber.py +++ b/tools/tu-deck-grabber.py @@ -646,10 +646,13 @@ def setDeckCards(self, card_map = {} for cid in card_ids: card_map[cid] = card_map.get(cid, 0) + 1 - card_map_texted = '{' - for k, v in card_map.items(): - card_map_texted += f'"{k}":"{v}",' - card_map_texted = card_map_texted[:-1] + '}' + if card_map: + card_map_texted = '{' + for k, v in card_map.items(): + card_map_texted += f'"{k}":"{v}",' + card_map_texted = card_map_texted[:-1] + '}' + else: + card_map_texted = '{}' rd = self.__mkRequestData('setDeckCards', { 'deck_id': str(deck_id), 'dominion_id': str(dominion_id),