mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 11:40:25 +00:00
account for undfined lastCrons
This commit is contained in:
parent
4fae8f05a4
commit
3242ce6e95
2 changed files with 5 additions and 2 deletions
|
|
@ -97,7 +97,10 @@ resetDom = (model) ->
|
|||
|
||||
ready (model) ->
|
||||
user = model.at('_user')
|
||||
user.set('lastCron', +new Date) if user.get('lastCron')=='new' #set cron immediately
|
||||
|
||||
#set cron immediately
|
||||
lastCron = user.get('lastCron')
|
||||
user.set('lastCron', +new Date) if (!lastCron or lastCron == 'new')
|
||||
|
||||
# Setup model in scoring functions
|
||||
scoring.setModel(model)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ _ = require 'underscore'
|
|||
module.exports.userSchema = ->
|
||||
# deep clone, else further new users get duplicate objects
|
||||
newUser = require('lodash').cloneDeep
|
||||
lastCron: 'new' #this will be replaced with a date on first run
|
||||
lastCron: 'new' #this will be replaced with `+new Date` on first run
|
||||
balance: 2
|
||||
stats: { money: 0, exp: 0, lvl: 1, hp: 50 }
|
||||
items: { itemsEnabled: false, armor: 0, weapon: 0 }
|
||||
|
|
|
|||
Loading…
Reference in a new issue