mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-19 20:28:53 +00:00
#315 fixes: newValue not accessible at scope, only remove duff history
entries, not all
This commit is contained in:
parent
0332ee7b48
commit
72e81b8891
2 changed files with 4 additions and 4 deletions
|
|
@ -1,14 +1,14 @@
|
|||
// mongo habitrpg ./node_modules/underscore/underscore.js ./migrations/20130307_remove_duff_histories.js
|
||||
/**
|
||||
* Remove duff histories for dailies
|
||||
*/
|
||||
// mongo habitrpg ./node_modules/underscore/underscore.js ./migrations/20130307_remove_duff_histories.js
|
||||
db.users.find().forEach(function(user){
|
||||
|
||||
|
||||
_.each(user.tasks, function(task, key){
|
||||
// remove task history
|
||||
if (task.type === "daily") {
|
||||
task.history = []
|
||||
// remove busted history entries
|
||||
task.history = _.filter(task.history, function(h){return !!h.value})
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ cron = (model) ->
|
|||
batch.set "tasks.#{taskObj.id}.value", newValue
|
||||
|
||||
taskObj.history ?= []
|
||||
taskObj.history.push { date: +new Date, value: newValue || taskObj.value }
|
||||
taskObj.history.push { date: +new Date, value: taskObj.value }
|
||||
batch.set "tasks.#{taskObj.id}.history", taskObj.history
|
||||
batch.set "tasks.#{taskObj.id}.completed", false
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue