From 5c6a725712a443b4d03b4f86262033ddfb66bc3d Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Fri, 25 Jan 2019 10:47:36 +0100 Subject: Make sure Swimlanes and Lists have a populated sort field When moving around the swimlanes or the lists, if one element has a sort with a null value, the computation of the new sort value is aborted, meaning that there are glitches in the UI. This happens on the first swimlane created with the new board, or when a swimlane or a list gets added through the API. --- models/boards.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'models/boards.js') 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; -- cgit v1.2.3-1-g7c22