mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
[#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:
parent
a579698865
commit
5fffc32ad3
1 changed files with 18 additions and 0 deletions
18
migrations/20131117_fix_task_types.js
Normal file
18
migrations/20131117_fix_task_types.js
Normal 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}});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue