added cron update on each transaction.

This commit is contained in:
yangit 2013-07-12 00:36:06 +08:00
parent a9dd42cda5
commit 50918ffea8

View file

@ -53,6 +53,13 @@ router.post '/', auth, (req, res) ->
console.log util.inspect req.body
misc.batchTxn model, (uObj, paths) ->
# habitrpg-shared/algos requires uObj.habits, uObj.dailys etc instead of uObj.tasks
_.each ['habit','daily','todo','reward'], (type) -> uObj["#{type}s"] = _.where(uObj.tasks, {type}); true
algos.cron uObj, {paths}
,{cron:true}
_.each ['habit', 'daily', 'todo', 'reward'], (type) ->
model.refList "_#{type}List", "_user.tasks", "_user.#{type}Ids"