fix(cron): only process checklists if they exist

This commit is contained in:
Matteo Pagliazzi 2016-05-26 22:17:15 +02:00
parent 9c7622e5a5
commit b03985c6b2

View file

@ -72,8 +72,10 @@ function performSleepTasks (user, tasksByType, now) {
if (shouldDo(thatDay.toDate(), daily, user.preferences) || completed) {
// TODO also untick checklists if the Daily was due on previous missed days, if two or more days were missed at once -- https://github.com/HabitRPG/habitrpg/pull/7218#issuecomment-219256016
if (daily.checklist) {
daily.checklist.forEach(box => box.completed = false);
}
}
daily.completed = false;
});
@ -196,8 +198,10 @@ export function cron (options = {}) {
task.completed = false;
if (completed || scheduleMisses > 0) {
if (task.checklist) {
task.checklist.forEach(i => i.completed = false);
}
}
});
// move singleton Habits towards yellow.