feat(archive_todo): update to archive todos

I thought this bit of code was in the other repo. So long as part 3 follows
close behind this, there shouldn't be an issue
This commit is contained in:
Jason Butz 2014-04-18 12:33:45 -04:00
parent 17aed0a9d7
commit 52ff5a7d5a

View file

@ -485,7 +485,9 @@ api.wrap = (user, main=true) ->
# ------ # ------
clearCompleted: (req, cb) -> clearCompleted: (req, cb) ->
_.remove user.todos, (t)-> t.completed and !t.challenge?.id user.todos = _.map user.todos, (t)->
t.archived = true if t.completed and !t.challenge?.id
t
user.markModified? 'todos' user.markModified? 'todos'
cb? null, user.todos cb? null, user.todos