forgot to start transcation for cron
This commit is contained in:
@@ -80,8 +80,7 @@ module.exports.BatchUpdate = BatchUpdate = (model) ->
|
||||
# many cases, userObj.tasks.{taskId}.value is undefined - so we manually .get() each attribute here.
|
||||
# Additionally, for some reason after getting the user object, changing properies manually (userObj.stats.hp = 50)
|
||||
# seems to actually run user.set('stats.hp',50) which we don't want to do - so we deepClone here
|
||||
#_.each Object.keys(userSchema), (key) -> userObj[key] = lodash.cloneDeep user.get(key)
|
||||
#userObj = user.get()
|
||||
_.each Object.keys(userSchema), (key) -> userObj[key] = lodash.cloneDeep user.get(key)
|
||||
model._commit = (txn) ->
|
||||
txn.dontPersist = true
|
||||
origCommit.apply(model, arguments)
|
||||
|
||||
@@ -179,8 +179,9 @@ cron = (resetDom_cb) ->
|
||||
today = +new Date
|
||||
daysPassed = helpers.daysBetween(today, user.get('lastCron'))
|
||||
if daysPassed > 0
|
||||
user.set 'lastCron', today
|
||||
batch = new schema.BatchUpdate(model)
|
||||
batch.startTransaction()
|
||||
batch.set 'lastCron', today
|
||||
userObj = batch.userObj
|
||||
hpBefore = userObj.stats.hp #we'll use this later so we can animate hp loss
|
||||
# Tally each task
|
||||
|
||||
Reference in New Issue
Block a user