[#1844] some tasks have their "type" incorrectly set. I need to find out

what's causing this, for now fix in database
This commit is contained in:
Tyler Renelle 2013-11-17 11:09:31 -08:00
parent a579698865
commit 5fffc32ad3

View file

@ -0,0 +1,18 @@
// TODO figure out why this is happening in the first place
db.users.find({},{habits:1, dailys:1, todos:1, rewards:1}).forEach(function(user){
_.each(user.habits, function(task){
task.type = 'habit';
})
_.each(user.dailys, function(task){
task.type = 'daily';
})
_.each(user.todos, function(task){
task.type = 'todo';
})
_.each(user.rewards, function(task){
task.type = 'reward';
})
db.users.update({_id:user._id}, {$set:{habits: user.habits, dailys: user.dailys, todos: user.todos, rewards: user.rewards}});
});