mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
comment cleanup
This commit is contained in:
parent
ca91a3a07d
commit
cd30ab299f
1 changed files with 2 additions and 12 deletions
|
|
@ -197,24 +197,14 @@ cron = (userObj) ->
|
|||
lastCron = userObj.lastCron
|
||||
daysPassed = helpers.daysBetween(today, lastCron)
|
||||
if daysPassed > 0
|
||||
# Tally function, which is called asyncronously below - but function is defined here.
|
||||
# We need access to some closure variables above
|
||||
todoTally = 0
|
||||
userObj.history ||= {}; userObj.history.todos ||= []; userObj.history.exp ||= []
|
||||
|
||||
# Tally each task
|
||||
# _.each user.get('tasks'), (taskObj) -> tallyTask(taskObj, ->)
|
||||
# Asyncronous version:
|
||||
tasks = _.toArray(userObj.tasks)
|
||||
userObj.history ||= {}
|
||||
userObj.history.todos ||= []
|
||||
userObj.history.exp ||= []
|
||||
|
||||
_.each tasks, (taskObj) ->
|
||||
# setTimeout {THIS_FUNCTION}, 1 # strange hack that seems necessary when using async
|
||||
{id, type, completed, repeat} = taskObj
|
||||
#don't know why this happens, but it does. need to investigate
|
||||
unless id?
|
||||
return callback('a task had a null id during cron, this should not be happening')
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue