mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
fix(cron): reset checklists as needed
This commit is contained in:
@@ -46,14 +46,20 @@ async function updateTeamTasks (team) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
forEach(tasksByType.dailys, daily => {
|
forEach(tasksByType.dailys, daily => {
|
||||||
|
let processChecklist = false;
|
||||||
if (daily.completed) {
|
if (daily.completed) {
|
||||||
|
processChecklist = true;
|
||||||
daily.completed = false;
|
daily.completed = false;
|
||||||
} else if (shouldDo(team.cron.lastProcessed, daily, teamLeader.preferences)) {
|
} else if (shouldDo(team.cron.lastProcessed, daily, teamLeader.preferences)) {
|
||||||
|
processChecklist = true;
|
||||||
const delta = TASK_VALUE_CHANGE_FACTOR ** daily.value;
|
const delta = TASK_VALUE_CHANGE_FACTOR ** daily.value;
|
||||||
daily.value -= delta;
|
daily.value -= delta;
|
||||||
if (daily.value < MIN_TASK_VALUE) daily.value = MIN_TASK_VALUE;
|
if (daily.value < MIN_TASK_VALUE) daily.value = MIN_TASK_VALUE;
|
||||||
}
|
}
|
||||||
daily.isDue = shouldDo(new Date(), daily, teamLeader.preferences);
|
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());
|
toSave.push(daily.save());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user