Skip to content

Commit

Permalink
Merge pull request #269 from yoganlava/dev-decklist-import
Browse files Browse the repository at this point in the history
Empty deck before importing
  • Loading branch information
willroberts authored Jan 17, 2023
2 parents 50dedfd + bbe4c2c commit c31def8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/ui/models/deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ var DeckModel = Backbone.Model.extend({
return changed;
},

emptyDeck: function () {
this.set('cards', []);
this._cardModels.reset();
},

getCountForBaseCardId: function (cardId) {
var count = 0;

Expand Down
1 change: 1 addition & 0 deletions app/ui/views2/collection/deck.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ var DeckLayout = Backbone.Marionette.LayoutView.extend({

// convert card data from base 64 into array of [count:id][count:id]...
val = atob(val);
this.model.emptyDeck();
var cardsData = val.split(',');
var cardIdsToAdd = [];
var phantomCardIdsToAdd = [];
Expand Down

0 comments on commit c31def8

Please sign in to comment.