Tasks is due (#8711)

* Added isDue field and isDue set on create

* Added isDue update on update task

* Add isdue calc to score task

* Added isdue calc to cron

* Fixed lint issue

* Added isDue to no set and updated grammar
This commit is contained in:
Keith Holliday
2017-05-10 07:40:45 -06:00
committed by GitHub
parent 638c9dee89
commit 727cdc9402
8 changed files with 34 additions and 1 deletions

View File

@@ -92,7 +92,7 @@ export let TaskSchema = new Schema({
}, discriminatorOptions));
TaskSchema.plugin(baseModel, {
noSet: ['challenge', 'userId', 'completed', 'history', 'dateCompleted', '_legacyId', 'group'],
noSet: ['challenge', 'userId', 'completed', 'history', 'dateCompleted', '_legacyId', 'group', 'isDue'],
sanitizeTransform (taskObj) {
if (taskObj.type && taskObj.type !== 'reward') { // value should be settable directly only for rewards
delete taskObj.value;
@@ -242,6 +242,7 @@ export let DailySchema = new Schema(_.defaults({
streak: {type: Number, default: 0},
daysOfMonth: {type: [Number], default: []}, // Days of the month that the daily should repeat on
weeksOfMonth: {type: [Number], default: []}, // Weeks of the month that the daily should repeat on
isDue: {type: Boolean},
}, habitDailySchema(), dailyTodoSchema()), subDiscriminatorOptions);
export let daily = Task.discriminator('daily', DailySchema);