mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
habitrpg-shared: bug fixes on hydrate()
This commit is contained in:
parent
258cf55abb
commit
77e37804e8
2 changed files with 6 additions and 4 deletions
|
|
@ -6,9 +6,11 @@ helpers = require('habitrpg-shared/script/helpers')
|
|||
###
|
||||
Make sure model.get() returns all properties, see https://github.com/codeparty/racer/issues/116
|
||||
###
|
||||
module.exports.hydrate = hydrate = (spec, hydrated={}) ->
|
||||
if _.isPlainObject(spec)
|
||||
hydrated[k] = hydrate(v, hydrated[k]) for k,v of spec
|
||||
module.exports.hydrate = hydrate = (spec) ->
|
||||
if _.isObject(spec) and !_.isArray(spec)
|
||||
hydrated = {}
|
||||
keys = _.keys(spec).concat(_.keys(spec.__proto__))
|
||||
keys.forEach (k) -> hydrated[k] = hydrate(spec[k])
|
||||
hydrated
|
||||
else spec
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module.exports.app = (appExports, model) ->
|
|||
perform the updates while tracking paths, then all the values at those paths
|
||||
###
|
||||
score = (taskId, direction) ->
|
||||
# return setTimeout( (-> score(taskId, direction)), 500) if model._txnQueue.length > 0
|
||||
#return setTimeout( (-> score(taskId, direction)), 500) if model._txnQueue.length > 0
|
||||
|
||||
uObj = misc.hydrate(user.get()) # see https://github.com/codeparty/racer/issues/116
|
||||
tObj = uObj.tasks[taskId]
|
||||
|
|
|
|||
Loading…
Reference in a new issue