mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Added nextDue field
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user