Enabled repeatables (#8572)

* Enabled repeatables

* Added every x to weekly

* Updated new recur logic to work with tests

* Added repeatable tests back

* Added custom day start support

* Moved back to zone function

* Added zone back

* Added nextDue field

* Abstracted set next due logic, set offset, and mapped to ISO

* Removed extra codes

* Removed clone deep

* Added summary local

* Fixed every x weekly

* Prevented edit of repeats on

* Added next due date

* Fixed display of next due dates

* Fixed broken tests

* added next due date as today for weekly

* Fixed integration tests

* Updated common test

* Use user's format

* Allow user to deselect all days during week

* Removed let from front end
This commit is contained in:
Keith Holliday
2017-05-24 18:49:33 -06:00
committed by Sabe Jones
parent ba66a1c098
commit cc532fa993
14 changed files with 993 additions and 269 deletions

View File

@@ -4,6 +4,7 @@ import { model as User } from '../models/user';
import common from '../../common/';
import { preenUserHistory } from '../libs/preening';
import _ from 'lodash';
import cloneDeep from 'lodash/cloneDeep';
import nconf from 'nconf';
const CRON_SAFE_MODE = nconf.get('CRON_SAFE_MODE') === 'true';
@@ -314,7 +315,15 @@ export function cron (options = {}) {
value: task.value,
});
task.completed = false;
task.isDue = common.shouldDo(Date.now(), task, user.preferences);
let optionsForShouldDo = cloneDeep(user.preferences.toObject());
task.isDue = common.shouldDo(now, task, optionsForShouldDo);
optionsForShouldDo.nextDue = true;
let nextDue = common.shouldDo(now, task, optionsForShouldDo);
if (nextDue && nextDue.length > 0) {
task.nextDue = nextDue;
}
if (completed || scheduleMisses > 0) {
if (task.checklist) {