diff options
Diffstat (limited to 'models/swimlanes.js')
-rw-r--r-- | models/swimlanes.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/models/swimlanes.js b/models/swimlanes.js index 769aaed3..aa7016f7 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -38,6 +38,8 @@ Swimlanes.attachSchema( autoValue() { if (this.isInsert) { return new Date(); + } else if (this.isUpsert) { + return { $setOnInsert: new Date() }; } else { this.unset(); } @@ -172,6 +174,25 @@ Swimlanes.helpers({ }, lists() { + //currentUser = Meteor.user(); + //if (currentUser) { + // enabled = Meteor.user().hasSortBy(); + //} + //return enabled ? this.newestLists() : this.draggableLists(); + return this.draggableLists(); + }, + newestLists() { + // sorted lists from newest to the oldest, by its creation date or its cards' last modification date + return Lists.find( + { + boardId: this.boardId, + swimlaneId: { $in: [this._id, ''] }, + archived: false, + }, + { sort: { modifiedAt: -1 } }, + ); + }, + draggableLists() { return Lists.find( { boardId: this.boardId, |