Updating the task list cleanup to not restore the completedIds list.

Fixing the mocha test to not check for the completedIds.
This commit is contained in:
Tobias Leugger 2013-01-27 18:55:46 +01:00
parent b697e7bdf1
commit 61b848bf4f
2 changed files with 1 additions and 5 deletions

View file

@ -59,15 +59,12 @@ get '/', (page, model, next) ->
## Task List Cleanup
# FIXME temporary hack to fix lists (Need to figure out why these are happening)
# FIXME consolidate these all under user.listIds so we can set them en-masse
_.each ['habit','daily','todo', 'completed', 'reward'], (type) ->
_.each ['habit','daily','todo','reward'], (type) ->
path = "#{type}Ids"
# 1. remove duplicates
# 2. restore missing zombie tasks back into list
where = {type:type}
if type in ['completed', 'todo']
where.type = 'todo'
where.completed = if type == 'completed' then true else false
taskIds = _.pluck( _.where(userObj.tasks, where), 'id')
union = _.union userObj[path], taskIds

View file

@ -84,7 +84,6 @@ describe 'User', ->
expect(_.size(user.habitIds)).to.eql 3
expect(_.size(user.dailyIds)).to.eql 3
expect(_.size(user.todoIds)).to.eql 1
expect(_.size(user.completedIds)).to.eql 0
expect(_.size(user.rewardIds)).to.eql 2
##### Habits #####