mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
just wrap scoring.cron in a try/catch, i'm sick of this
This commit is contained in:
parent
fb0d4d6d44
commit
2ddab98c82
2 changed files with 6 additions and 4 deletions
|
|
@ -58,7 +58,10 @@ get '/', (page, model, next) ->
|
|||
|
||||
model.ref '_user', user
|
||||
scoring.setModel(model)
|
||||
scoring.cron(userObj)
|
||||
try
|
||||
scoring.cron userObj
|
||||
catch e # always random errors, dont' crash the server
|
||||
console.error e
|
||||
|
||||
model.set userPath, userObj #unless _.isEqual(user.get(), userObj)
|
||||
|
||||
|
|
|
|||
|
|
@ -196,10 +196,8 @@ cron = (userObj) ->
|
|||
lastCron = userObj.lastCron
|
||||
daysPassed = helpers.daysBetween(today, lastCron)
|
||||
if daysPassed > 0
|
||||
todoTally = 0
|
||||
userObj.history ?= {}; userObj.history.todos ?= []; userObj.history.exp ?= []
|
||||
|
||||
# Tally each task
|
||||
todoTally = 0
|
||||
_.each userObj.tasks, (taskObj) ->
|
||||
#FIXME remove broken tasks
|
||||
if taskObj.id? # a task had a null id during cron, this should not be happening
|
||||
|
|
@ -230,6 +228,7 @@ cron = (userObj) ->
|
|||
todoTally += absVal
|
||||
|
||||
# Finished tallying
|
||||
userObj.history ?= {}; userObj.history.todos ?= []; userObj.history.exp ?= []
|
||||
userObj.history.todos.push { date: today, value: todoTally }
|
||||
# tally experience
|
||||
expTally = userObj.stats.exp
|
||||
|
|
|
|||
Loading…
Reference in a new issue