mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 11:40:25 +00:00
pass in resetDom as callback to cron
This commit is contained in:
parent
52b2532b5a
commit
3cb9749f57
2 changed files with 3 additions and 4 deletions
|
|
@ -114,7 +114,7 @@ ready (model) ->
|
|||
|
||||
# Setup model in scoring functions
|
||||
scoring.setModel(model)
|
||||
scoring.cron()
|
||||
scoring.cron(resetDom)
|
||||
|
||||
# Load all the jQuery, Growl, Tour, etc
|
||||
browser.loadJavaScripts(model)
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ score = (taskId, direction, times, update) ->
|
|||
At end of day, add value to all incomplete Daily & Todo tasks (further incentive)
|
||||
For incomplete Dailys, deduct experience
|
||||
###
|
||||
cron = ->
|
||||
cron = (resetDom_cb) ->
|
||||
today = +new Date
|
||||
daysPassed = helpers.daysBetween(today, user.get('lastCron'))
|
||||
if daysPassed > 0
|
||||
|
|
@ -233,8 +233,7 @@ cron = ->
|
|||
[hpAfter, userObj.stats.hp] = [userObj.stats.hp, hpBefore]
|
||||
user.set 'stats', userObj.stats
|
||||
user.set 'history', userObj.history
|
||||
window.DERBY.app.dom.clear()
|
||||
window.DERBY.app.view.render(model)
|
||||
resetDom_cb(model)
|
||||
setTimeout (-> user.set 'stats.hp', hpAfter), 1000 # animate hp loss
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue