From 61b848bf4f3c0aaf0c2a9fe1ef2c19782067cedb Mon Sep 17 00:00:00 2001 From: Tobias Leugger Date: Sun, 27 Jan 2013 18:55:46 +0100 Subject: [PATCH] Updating the task list cleanup to not restore the completedIds list. Fixing the mocha test to not check for the completedIds. --- src/app/index.coffee | 5 +---- test/user.mocha.coffee | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/index.coffee b/src/app/index.coffee index bb60c11bda..c8092ce971 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -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 diff --git a/test/user.mocha.coffee b/test/user.mocha.coffee index 868786c14c..33b1917014 100644 --- a/test/user.mocha.coffee +++ b/test/user.mocha.coffee @@ -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 #####