rest bug - lastCron must be set before "return if resting", otherwise

when they unrest they'll get piled by all the days they missed
This commit is contained in:
Tyler Renelle
2013-04-14 21:44:30 -04:00
parent 0342e9a4e7
commit 0de27373ad
+3 -2
View File
@@ -258,13 +258,14 @@ updateStats = (model, newStats, batch) ->
cron = (model) ->
user = model.at '_user'
today = +new Date
return if user.get 'flags.rest'
daysPassed = helpers.daysBetween(user.get('lastCron'), today, user.get('preferences.dayStart'))
if daysPassed > 0
user.set 'lastCron', today # at least this must be called, even if user resting
return if user.get 'flags.rest'
batch = new character.BatchUpdate(model)
batch.startTransaction()
batch.set 'lastCron', today
obj = batch.obj()
hpBefore = obj.stats.hp #we'll use this later so we can animate hp loss
# Tally each task