mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
feat(archive_todo): add cron to archive todos
This is part 2 of habitrpg#3062. Part 1 MUST be merged first. Part 1 pull request: habitrpg#3302
This commit is contained in:
parent
c15789d6ae
commit
17aed0a9d7
1 changed files with 4 additions and 0 deletions
|
|
@ -1237,6 +1237,10 @@ api.wrap = (user, main=true) ->
|
|||
else
|
||||
task.value = task.value / 2
|
||||
|
||||
user.todos.forEach (task) -> # Archive todos
|
||||
if !task.archived && task.completed && moment(now).subtract('days',3).isAfter(moment(task.dateCompleted))
|
||||
task.archived = true
|
||||
|
||||
|
||||
# Finished tallying
|
||||
((user.history ?= {}).todos ?= []).push { date: now, value: todoTally }
|
||||
|
|
|
|||
Loading…
Reference in a new issue