mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-22 10:55:19 -04:00
Fixed typo with new LevelSession game completion tracking.
This commit is contained in:
parent
055922a967
commit
faae8aed81
1 changed files with 3 additions and 3 deletions
|
@ -40,19 +40,19 @@ LevelSessionSchema.pre 'save', (next) ->
|
|||
@set('changed', new Date())
|
||||
|
||||
id = @get('id')
|
||||
initd = doc.previousStateInfo?
|
||||
initd = @previousStateInfo?
|
||||
levelID = @get('levelID')
|
||||
userID = @get('creator')
|
||||
activeUserEvent = null
|
||||
|
||||
# Newly completed level
|
||||
if not (initd and doc.previousStateInfo['state.complete']) and @get('state.complete')
|
||||
if not (initd and @previousStateInfo['state.complete']) and @get('state.complete')
|
||||
User.update {_id: userID}, {$inc: 'stats.gamesCompleted': 1}, {}, (err, count) ->
|
||||
log.error err if err?
|
||||
activeUserEvent = "level-completed/#{levelID}"
|
||||
|
||||
# Spent at least 30s playing this level
|
||||
if not initd and @get('playtime') >= 30 or initd and (@get('playtime') - doc.previousStateInfo['playtime'] >= 30)
|
||||
if not initd and @get('playtime') >= 30 or initd and (@get('playtime') - @previousStateInfo['playtime'] >= 30)
|
||||
activeUserEvent = "level-playtime/#{levelID}"
|
||||
|
||||
if activeUserEvent?
|
||||
|
|
Loading…
Reference in a new issue