From fb216fba8e455dcfa5c396097ec6d889b72e8b8e Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Wed, 18 Aug 2021 23:48:42 -0500 Subject: [PATCH] fix(cron): reset checklists as needed --- scripts/team-cron.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/team-cron.js b/scripts/team-cron.js index a08fde261e..e1723f129d 100644 --- a/scripts/team-cron.js +++ b/scripts/team-cron.js @@ -46,14 +46,20 @@ async function updateTeamTasks (team) { } }); forEach(tasksByType.dailys, daily => { + let processChecklist = false; if (daily.completed) { + processChecklist = true; daily.completed = false; } else if (shouldDo(team.cron.lastProcessed, daily, teamLeader.preferences)) { + processChecklist = true; const delta = TASK_VALUE_CHANGE_FACTOR ** daily.value; daily.value -= delta; if (daily.value < MIN_TASK_VALUE) daily.value = MIN_TASK_VALUE; } daily.isDue = shouldDo(new Date(), daily, teamLeader.preferences); + if (processChecklist && daily.checklist.length > 0) { + daily.checklist.forEach(i => { i.completed = false; }); + } toSave.push(daily.save()); });