mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-29 06:07:32 +00:00
29 lines
604 B
JavaScript
29 lines
604 B
JavaScript
|
|
// mongo habitrpg ./node_modules/underscore/underscore.js ./migrations/20130307_normalize_algo_values.js
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Remove duff histories for dailies
|
||
|
|
*/
|
||
|
|
db.users.find().forEach(function(user){
|
||
|
|
|
||
|
|
|
||
|
|
_.each(user.tasks, function(task, key){
|
||
|
|
// remove task history
|
||
|
|
if (task.type === "daily") {
|
||
|
|
task.history = []
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
try {
|
||
|
|
db.users.update(
|
||
|
|
{_id:user._id},
|
||
|
|
{$set:
|
||
|
|
{
|
||
|
|
'tasks' : user.tasks
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{multi:true}
|
||
|
|
);
|
||
|
|
} catch(e) {
|
||
|
|
print(e);
|
||
|
|
}
|
||
|
|
})
|