Task order fix (#8928)

This commit is contained in:
Tyler Nychka
2017-10-26 11:37:51 -04:00
committed by Sabe Jones
parent 26123ac6ae
commit bba2e71af3
2 changed files with 73 additions and 0 deletions

View File

@@ -403,6 +403,13 @@ export function cron (options = {}) {
user.history.exp.push({date: now, value: expTally});
// Remove any remaining completed todos from the list of active todos
user.tasksOrder.todos = user.tasksOrder.todos.filter(taskOrderId => {
return _.some(tasksByType.todos, taskType => {
return taskType._id === taskOrderId && taskType.completed === false;
});
});
// preen user history so that it doesn't become a performance problem
// also for subscribed users but differently
// TODO also do while resting in the inn. Note that later we'll be allowing the value/color of tasks to change while sleeping (https://github.com/HabitRPG/habitica/issues/5232), so the code in performSleepTasks() might be best merged back into here for that. Perhaps wait until then to do preen history for sleeping users.