Fixes card-number migration

and further optimizes getNextCardNumber in board model
This commit is contained in:
Kai Lehmann 2021-08-02 22:06:34 +02:00
parent 28e9a6ac33
commit 236b6c3552
2 changed files with 9 additions and 8 deletions

View file

@ -1066,12 +1066,7 @@ Boards.helpers({
getNextCardNumber() {
const boardCards = Cards.find({ boardId: this._id }).fetch();
if (boardCards.length == 0) {
return 1;
}
const maxCardNumber = Math.max(...boardCards
.map(c => c.cardNumber ? c.cardNumber : 0));
return maxCardNumber + 1;
return boardCards.length + 1;
},
cardsDueInBetween(start, end) {