mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 11:40:25 +00:00
bug fixes
This commit is contained in:
parent
9877f30fe9
commit
4d93f51d55
2 changed files with 4 additions and 4 deletions
|
|
@ -57,9 +57,9 @@ get '/', (page, model, next) ->
|
|||
|
||||
model.ref '_user', user
|
||||
scoring.setModel(model)
|
||||
userObj = scoring.cron(userObj)
|
||||
scoring.cron(userObj)
|
||||
|
||||
model.set "users.#{userObj.id}", userObj unless _.isEqual(user.get('userObj'), userObj)
|
||||
model.set "users.#{userObj.id}", userObj unless _.isEqual(user.get(), userObj)
|
||||
model.set '_view', _view
|
||||
|
||||
# Setup Task Lists
|
||||
|
|
|
|||
|
|
@ -202,8 +202,8 @@ cron = (userObj) ->
|
|||
# Tally each task
|
||||
tasks = _.toArray(userObj.tasks)
|
||||
_.each tasks, (taskObj) ->
|
||||
return unless taskObj? and taskObj.id? # a task had a null id during cron, this should not be happening
|
||||
{id, type, completed, repeat} = taskObj
|
||||
return unless id? # a task had a null id during cron, this should not be happening
|
||||
if type in ['todo', 'daily']
|
||||
# Deduct experience for missed Daily tasks,
|
||||
# but not for Todos (just increase todo's value)
|
||||
|
|
@ -224,10 +224,10 @@ cron = (userObj) ->
|
|||
if type == 'daily'
|
||||
userObj.tasks[taskObj.id].history ||= []
|
||||
userObj.tasks[taskObj.id].history.push { date: today, value: value }
|
||||
userObj.tasks[taskObj.id].completed = false
|
||||
else
|
||||
absVal = if (completed) then Math.abs(value) else value
|
||||
todoTally += absVal
|
||||
userObj.tasks[taskObj.id].completed = false if type == 'daily'
|
||||
|
||||
# Finished tallying, this is the 'completed' callback
|
||||
userObj.history.todos.push { date: today, value: todoTally }
|
||||
|
|
|
|||
Loading…
Reference in a new issue