diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-25 10:47:36 +0100 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-25 11:04:56 +0100 |
commit | 5c6a725712a443b4d03b4f86262033ddfb66bc3d (patch) | |
tree | b3b2d0e70df516900e626a7edb17d27cdee319a6 /models | |
parent | 03efeaeb1abae0c8c39ad5644d44bad36f415d99 (diff) | |
download | wekan-5c6a725712a443b4d03b4f86262033ddfb66bc3d.tar.gz wekan-5c6a725712a443b4d03b4f86262033ddfb66bc3d.tar.bz2 wekan-5c6a725712a443b4d03b4f86262033ddfb66bc3d.zip |
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.
Diffstat (limited to 'models')
-rw-r--r-- | models/boards.js | 16 |
1 files changed, 16 insertions, 0 deletions
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; |