Fixed #2181, I hope.

This commit is contained in:
Nick Winter 2015-02-12 11:59:38 -08:00
parent 6b9d8161ef
commit e01e71d5e8

View file

@ -56,27 +56,26 @@ module.exports = class LadderSubmissionView extends CocoView
failure = (jqxhr, textStatus, errorThrown) => failure = (jqxhr, textStatus, errorThrown) =>
console.log jqxhr.responseText console.log jqxhr.responseText
@setRankingButtonText 'failed' unless @destroyed @setRankingButtonText 'failed' unless @destroyed
transpiledCode = @transpileSession() @transpileSession (transpiledCode) =>
ajaxData = ajaxData =
session: @session.id session: @session.id
levelID: @level.id levelID: @level.id
originalLevelID: @level.get('original') originalLevelID: @level.get('original')
levelMajorVersion: @level.get('version').major levelMajorVersion: @level.get('version').major
transpiledCode: transpiledCode transpiledCode: transpiledCode
$.ajax '/queue/scoring', { $.ajax '/queue/scoring', {
type: 'POST' type: 'POST'
data: ajaxData data: ajaxData
success: success success: success
error: failure error: failure
} }
transpileSession: -> transpileSession: (callback) ->
submittedCode = @session.get('code') submittedCode = @session.get('code')
codeLanguage = @session.get('codeLanguage') or 'javascript' codeLanguage = @session.get('codeLanguage') or 'javascript'
@session.set('submittedCodeLanguage', codeLanguage) @session.set('submittedCodeLanguage', codeLanguage)
@session.save() # TODO: maybe actually use a callback to make sure this works?
transpiledCode = {} transpiledCode = {}
for thang, spells of submittedCode for thang, spells of submittedCode
transpiledCode[thang] = {} transpiledCode[thang] = {}
@ -85,7 +84,7 @@ module.exports = class LadderSubmissionView extends CocoView
aetherOptions = createAetherOptions functionName: spellID, codeLanguage: codeLanguage aetherOptions = createAetherOptions functionName: spellID, codeLanguage: codeLanguage
aether = new Aether aetherOptions aether = new Aether aetherOptions
transpiledCode[thang][spellID] = aether.transpile spell transpiledCode[thang][spellID] = aether.transpile spell
transpiledCode @session.save null, success: -> callback transpiledCode
onHelpSimulate: -> onHelpSimulate: ->
@playSound 'menu-button-click' @playSound 'menu-button-click'