Skip to content

Commit

Permalink
fix: reimport template decks when their cards change
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Jul 5, 2024
1 parent bf75cff commit 96df528
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions Hearthstone Deck Tracker/DeckManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,7 @@ public static void AutoSelectTemplateDeckByDeckTemplateId(IGame game, int deckTe
if(selectedDeck == null)
return;
var deckId = selectedDeck.Deck.Id;
if(DeckList.Instance.Decks.All(x => x.HsId != deckId))
{
ImportDecks(new List<ImportedDeck>() { selectedDeck }, false);
}
ImportDecks(new List<ImportedDeck>() { selectedDeck }, false);
AutoSelectDeckById(game, deckId);
}

Expand Down
3 changes: 2 additions & 1 deletion Hearthstone Deck Tracker/Importing/DeckImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public static List<ImportedDeck> GetImportedDecks(IEnumerable<HearthMirror.Objec
var deck = GetTemplateDeck(deckTemplateId);
if(deck is null)
return null;
return new ImportedDeck(deck, null, DeckList.Instance.Decks);
var matches = GetImportedDecks(new[] { deck }, DeckList.Instance.Decks);
return matches.Count == 1 ? matches[0] : null;
}

private static HearthMirror.Objects.Deck? GetTemplateDeck(int deckTemplateId)
Expand Down

0 comments on commit 96df528

Please sign in to comment.