Merge remote-tracking branch 'TheHollidayInn/yesterdailies-2' into release
This commit is contained in:
@@ -85,8 +85,10 @@ export function startOfDay (options = {}) {
|
||||
|
||||
export function daysSince (yesterday, options = {}) {
|
||||
let o = sanitizeOptions(options);
|
||||
let startOfNow = startOfDay(defaults({ now: o.now }, o));
|
||||
let startOfYesterday = startOfDay(defaults({ now: yesterday }, o));
|
||||
|
||||
return startOfDay(defaults({ now: o.now }, o)).diff(startOfDay(defaults({ now: yesterday }, o)), 'days');
|
||||
return startOfNow.diff(startOfYesterday, 'days');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
shouldDo,
|
||||
} from '../cron';
|
||||
import moment from 'moment';
|
||||
|
||||
/*
|
||||
Task classes given everything about the class
|
||||
@@ -8,7 +9,7 @@ Task classes given everything about the class
|
||||
|
||||
// TODO move to the client
|
||||
|
||||
module.exports = function taskClasses (task, filters = [], dayStart = 0, lastCron = Number(new Date()), showCompleted = false, main = false) {
|
||||
module.exports = function taskClasses (task, filters = [], dayStart = 0, lastCron = Number(new Date()), showCompleted = false, main = false, processingYesterdailies = false) {
|
||||
if (!task) {
|
||||
return '';
|
||||
}
|
||||
@@ -34,7 +35,9 @@ module.exports = function taskClasses (task, filters = [], dayStart = 0, lastCro
|
||||
}
|
||||
|
||||
if (type === 'todo' || type === 'daily') {
|
||||
let notDue = !shouldDo(Number(new Date()), task, { dayStart });
|
||||
let dayShouldDo = moment();
|
||||
if (processingYesterdailies) dayShouldDo.subtract(1, 'days');
|
||||
let notDue = !shouldDo(Number(dayShouldDo), task, { dayStart });
|
||||
let isNotDueDaily = type === 'daily' && notDue;
|
||||
|
||||
if (completed || isNotDueDaily) {
|
||||
|
||||
@@ -25,6 +25,7 @@ module.exports = function taskDefaults (task = {}) {
|
||||
challenge: {
|
||||
shortName: 'None',
|
||||
},
|
||||
yesterDaily: true,
|
||||
reminders: [],
|
||||
attribute: 'str',
|
||||
createdAt: new Date(), // TODO these are going to be overwritten by the server...
|
||||
|
||||
Reference in New Issue
Block a user