mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Added transpiledCode to victory modal
This commit is contained in:
parent
dbcafbb29b
commit
338b613074
1 changed files with 28 additions and 1 deletions
|
@ -62,7 +62,12 @@ module.exports = class VictoryModal extends View
|
|||
button = @$el.find('.rank-game-button')
|
||||
button.text($.i18n.t('play_level.victory_ranking_game', defaultValue: 'Submitting...'))
|
||||
button.prop 'disabled', true
|
||||
ajaxData = session: @session.id, levelID: @level.id, originalLevelID: @level.get('original'), levelMajorVersion: @level.get('version').major
|
||||
ajaxData =
|
||||
session: @session.id
|
||||
levelID: @level.id
|
||||
originalLevelID: @level.get('original')
|
||||
levelMajorVersion: @level.get('version').major
|
||||
transpiledCode: @transpileSession @session
|
||||
ladderURL = "/play/ladder/#{@level.get('slug')}#my-matches"
|
||||
goToLadder = -> Backbone.Mediator.publish 'router:navigate', route: ladderURL
|
||||
$.ajax '/queue/scoring',
|
||||
|
@ -72,6 +77,28 @@ module.exports = class VictoryModal extends View
|
|||
failure: (response) ->
|
||||
console.error "Couldn't submit game for ranking:", response
|
||||
goToLadder()
|
||||
|
||||
transpileSession: (session) ->
|
||||
submittedCode = session.get('code')
|
||||
transpiledCode = {}
|
||||
for thang, spells of submittedCode
|
||||
transpiledCode[thang] = {}
|
||||
for spellID, spell of spells
|
||||
#DRY this
|
||||
aetherOptions =
|
||||
problems: {}
|
||||
language: "javascript"
|
||||
functionName: spellID
|
||||
functionParameters: []
|
||||
yieldConditionally: spellID is "plan"
|
||||
globals: ['Vector', '_']
|
||||
protectAPI: true
|
||||
includeFlow: false
|
||||
if spellID is "hear" then aetherOptions["functionParameters"] = ["speaker","message","data"]
|
||||
|
||||
aether = new Aether aetherOptions
|
||||
transpiledCode[thang][spellID] = aether.transpile spell
|
||||
transpiledCode
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
|
|
Loading…
Add table
Reference in a new issue