mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Make sure to save level sessions after difficulty increase.
This commit is contained in:
parent
36921f7644
commit
677ba56ce9
2 changed files with 3 additions and 2 deletions
app/models
|
@ -19,10 +19,10 @@ class CocoModel extends Backbone.Model
|
|||
@on 'error', @onError, @
|
||||
@on 'add', @onLoaded, @
|
||||
@saveBackup = _.debounce(@saveBackup, 500)
|
||||
@usesVersions = @schema().properties.version?
|
||||
@usesVersions = @schema()?.properties?.version?
|
||||
|
||||
backupKey: ->
|
||||
if @usesVersions then @id else @id + ':' + @attributes.__v # TODO: doesn't work because __v doesn't actually increment?
|
||||
if @usesVersions then @id else @id + ':' + @attributes.__v # TODO: doesn't work because __v doesn't actually increment. #2061
|
||||
|
||||
setProjection: (project) ->
|
||||
return if project is @project
|
||||
|
|
|
@ -59,6 +59,7 @@ module.exports = class LevelSession extends CocoModel
|
|||
state.difficulty = (state.difficulty ? 0) + 1
|
||||
delete state.lastUnsuccessfulSubmissionTime
|
||||
@set 'state', state
|
||||
@save()
|
||||
|
||||
timeUntilResubmit: ->
|
||||
state = @get('state') ? {}
|
||||
|
|
Loading…
Add table
Reference in a new issue