summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/lists.js11
-rw-r--r--server/rulesHelper.js4
2 files changed, 13 insertions, 2 deletions
diff --git a/models/lists.js b/models/lists.js
index 9bcb9ba1..b99fe8f5 100644
--- a/models/lists.js
+++ b/models/lists.js
@@ -86,6 +86,17 @@ Lists.helpers({
{ sort: ['sort'] });
},
+ cardsUnfiltered(swimlaneId) {
+ const selector = {
+ listId: this._id,
+ archived: false,
+ };
+ if (swimlaneId)
+ selector.swimlaneId = swimlaneId;
+ return Cards.find(selector,
+ { sort: ['sort'] });
+ },
+
allCards() {
return Cards.find({ listId: this._id });
},
diff --git a/server/rulesHelper.js b/server/rulesHelper.js
index 631ad4e9..e9139933 100644
--- a/server/rulesHelper.js
+++ b/server/rulesHelper.js
@@ -43,7 +43,7 @@ RulesHelper = {
list = Lists.findOne({title: action.listTitle, boardId });
listId = list._id;
}
- const minOrder = _.min(list.cards(card.swimlaneId).map((c) => c.sort));
+ const minOrder = _.min(list.cardsUnfiltered(card.swimlaneId).map((c) => c.sort));
card.move(card.swimlaneId, listId, minOrder - 1);
}
if(action.actionType === 'moveCardToBottom'){
@@ -56,7 +56,7 @@ RulesHelper = {
list = Lists.findOne({title: action.listTitle, boardId});
listId = list._id;
}
- const maxOrder = _.max(list.cards(card.swimlaneId).map((c) => c.sort));
+ const maxOrder = _.max(list.cardsUnfiltered(card.swimlaneId).map((c) => c.sort));
card.move(card.swimlaneId, listId, maxOrder + 1);
}
if(action.actionType === 'sendEmail'){