summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/boards/boardBody.js31
-rw-r--r--models/boards.js16
2 files changed, 47 insertions, 0 deletions
diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js
index ccbd0f23..ae5b67fd 100644
--- a/client/components/boards/boardBody.js
+++ b/client/components/boards/boardBody.js
@@ -35,6 +35,37 @@ BlazeComponent.extendComponent({
this._isDragging = false;
// Used to set the overlay
this.mouseHasEnterCardDetails = false;
+
+ // fix swimlanes sort field if there are null values
+ const currentBoardData = Boards.findOne(Session.get('currentBoard'));
+ const nullSortSwimlanes = currentBoardData.nullSortSwimlanes();
+ if (nullSortSwimlanes.count() > 0) {
+ const swimlanes = currentBoardData.swimlanes();
+ let count = 0;
+ swimlanes.forEach((s) => {
+ Swimlanes.update(s._id, {
+ $set: {
+ sort: count,
+ },
+ });
+ count += 1;
+ });
+ }
+
+ // fix lists sort field if there are null values
+ const nullSortLists = currentBoardData.nullSortLists();
+ if (nullSortLists.count() > 0) {
+ const lists = currentBoardData.lists();
+ let count = 0;
+ lists.forEach((l) => {
+ Lists.update(l._id, {
+ $set: {
+ sort: count,
+ },
+ });
+ count += 1;
+ });
+ }
},
onRendered() {
const boardComponent = this;
diff --git a/models/boards.js b/models/boards.js
index d92bec47..b0f5cecb 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -347,6 +347,14 @@ Boards.helpers({
return Lists.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } });
},
+ nullSortLists() {
+ return Lists.find({
+ boardId: this._id,
+ archived: false,
+ sort: { $eq: null },
+ });
+ },
+
swimlanes() {
return Swimlanes.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } });
},
@@ -362,6 +370,14 @@ Boards.helpers({
});
},
+ nullSortSwimlanes() {
+ return Swimlanes.find({
+ boardId: this._id,
+ archived: false,
+ sort: { $eq: null },
+ });
+ },
+
hasOvertimeCards(){
const card = Cards.findOne({isOvertime: true, boardId: this._id, archived: false} );
return card !== undefined;