summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-11-21 11:31:04 +0200
committerLauri Ojansivu <x@xet7.org>2017-11-21 11:31:04 +0200
commit9ea35b7188ca39a092755002c1cc5e97fee43a02 (patch)
treef5359aa002dcba218748de997d1f92a451d6c2a4 /models
parentf3e7646cfa065ceea0cf1aaff1f5adbde457a32a (diff)
parentd76387aed2c83a5876b2777598be6d534530cf4e (diff)
downloadwekan-9ea35b7188ca39a092755002c1cc5e97fee43a02.tar.gz
wekan-9ea35b7188ca39a092755002c1cc5e97fee43a02.tar.bz2
wekan-9ea35b7188ca39a092755002c1cc5e97fee43a02.zip
Merge branch 'thuanpq-card-spent-time' into devel
Spent time/Overtime on card. Thanks to thuanpq ! Closes #1337
Diffstat (limited to 'models')
-rw-r--r--models/boards.js10
-rw-r--r--models/cards.js26
2 files changed, 34 insertions, 2 deletions
diff --git a/models/boards.js b/models/boards.js
index 6ae818c6..594bb7b9 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -187,6 +187,16 @@ Boards.helpers({
return Lists.find({ boardId: this._id, archived: false }, { sort: { sort: 1 } });
},
+ hasOvertimeCards(){
+ const card = Cards.findOne({isOvertime: true, boardId: this._id, archived: false} );
+ return card !== undefined;
+ },
+
+ hasSpentTimeCards(){
+ const card = Cards.findOne({spentTime: { $gt: 0 }, boardId: this._id, archived: false} );
+ return card !== undefined;
+ },
+
activities() {
return Activities.find({ boardId: this._id }, { sort: { createdAt: -1 } });
},
diff --git a/models/cards.js b/models/cards.js
index b6397c9e..b62bfea8 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -64,8 +64,18 @@ Cards.attachSchema(new SimpleSchema({
type: Date,
optional: true,
},
- // XXX Should probably be called `authorId`. Is it even needed since we have
- // the `members` field?
+ spentTime: {
+ type: Number,
+ decimal: true,
+ optional: true,
+ },
+ isOvertime: {
+ type: Boolean,
+ defaultValue: false,
+ optional: true,
+ },
+ // XXX Should probably be called `authorId`. Is it even needed since we have
+ // the `members` field?
userId: {
type: String,
autoValue() { // eslint-disable-line consistent-return
@@ -273,6 +283,18 @@ Cards.mutations({
unsetDue() {
return {$unset: {dueAt: ''}};
},
+
+ setOvertime(isOvertime) {
+ return {$set: {isOvertime}};
+ },
+
+ setSpentTime(spentTime) {
+ return {$set: {spentTime}};
+ },
+
+ unsetSpentTime() {
+ return {$unset: {spentTime: '', isOvertime: false}};
+ },
});