mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
forgot to start transcation for cron
This commit is contained in:
parent
ba10f7943d
commit
4c5b8aacab
2 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue