Merge branch 'master' into production

This commit is contained in:
Nick Winter 2015-01-06 13:46:06 -08:00
commit 23f8f461d7
5 changed files with 15 additions and 8 deletions

View file

@ -28,11 +28,20 @@
<link rel="shortcut icon" href="/images/favicon.ico"> <link rel="shortcut icon" href="/images/favicon.ico">
<link rel="stylesheet" href="/stylesheets/app.css"> <link rel="stylesheet" href="/stylesheets/app.css">
<!-- IE9 doesn't support defer attribute: https://github.com/h5bp/lazyweb-requests/issues/42 -->
<!--[if IE 9]>
<script src="/lib/ace/ace.js"></script>
<script src="/javascripts/box2d.js"></script>
<script src="/javascripts/vendor.js"></script>
<script src="/javascripts/aether.js"></script>
<script src="/javascripts/app.js"></script>
<![endif]-->
<![if (gt IE 9)|(!IE)]>
<script src="/lib/ace/ace.js" defer></script> <script src="/lib/ace/ace.js" defer></script>
<!--[if IE 9]><script src="/javascripts/box2d.js"></script><![endif]-->
<script src="/javascripts/vendor.js" defer></script> <script src="/javascripts/vendor.js" defer></script>
<script src="/javascripts/aether.js" defer></script> <script src="/javascripts/aether.js" defer></script>
<script src="/javascripts/app.js" defer></script> <!-- it's all Backbone! --> <script src="/javascripts/app.js" defer></script> <!-- it's all Backbone! -->
<![endif]>
<script> <script>
// Placeholder for iPad, which inspects the user object at the bottom of an injected page. // Placeholder for iPad, which inspects the user object at the bottom of an injected page.

View file

@ -30,9 +30,9 @@ module.exports = class LevelBus extends Bus
super(arguments...) super(arguments...)
@changedSessionProperties = {} @changedSessionProperties = {}
if document.location.href.search('codecombat.com') isnt -1 if document.location.href.search('codecombat.com') isnt -1
@saveSession = _.debounce(@reallySaveSession, 10000, {maxWait: 30000}) # Save us during HoC @saveSession = _.debounce(@reallySaveSession, 4000, {maxWait: 10000}) # Save slower on production.
else else
@saveSession = _.debounce(@reallySaveSession, 1000, {maxWait: 5000}) # Not this fast during HoC @saveSession = _.debounce(@reallySaveSession, 1000, {maxWait: 5000}) # Save quickly in development.
@playerIsIdle = false @playerIsIdle = false
init: -> init: ->

View file

@ -19,10 +19,10 @@ class CocoModel extends Backbone.Model
@on 'error', @onError, @ @on 'error', @onError, @
@on 'add', @onLoaded, @ @on 'add', @onLoaded, @
@saveBackup = _.debounce(@saveBackup, 500) @saveBackup = _.debounce(@saveBackup, 500)
@usesVersions = @schema().properties.version? @usesVersions = @schema()?.properties?.version?
backupKey: -> 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) -> setProjection: (project) ->
return if project is @project return if project is @project

View file

@ -59,6 +59,7 @@ module.exports = class LevelSession extends CocoModel
state.difficulty = (state.difficulty ? 0) + 1 state.difficulty = (state.difficulty ? 0) + 1
delete state.lastUnsuccessfulSubmissionTime delete state.lastUnsuccessfulSubmissionTime
@set 'state', state @set 'state', state
@save()
timeUntilResubmit: -> timeUntilResubmit: ->
state = @get('state') ? {} state = @get('state') ? {}

View file

@ -733,9 +733,6 @@ module.exports = class SpellView extends CocoView
hashValue = aether.raw + aetherProblem.message hashValue = aether.raw + aetherProblem.message
return if hashValue of @savedProblems return if hashValue of @savedProblems
@savedProblems[hashValue] = true @savedProblems[hashValue] = true
if Math.random() > 0.01
# Let's only save a tiny fraction of these during HoC to reduce writes.
return
# Save new problem # Save new problem
@userCodeProblem = new UserCodeProblem() @userCodeProblem = new UserCodeProblem()