Conflicts:
	app/lib/simulator/Simulator.coffee
This commit is contained in:
Michael Schmatz 2014-05-15 16:44:16 -07:00
commit 65aae86dcc
3 changed files with 12 additions and 8 deletions
app

View file

@ -55,6 +55,7 @@ module.exports = class Simulator extends CocoClass
console.log info
@trigger 'statusUpdate', info
@simulateAnotherTaskAfterDelay()
application.tracker?.trackEvent 'Simulator Result', label: "No Games"
simulateAnotherTaskAfterDelay: =>
console.log "Retrying in #{@retryDelayInSeconds}"
@ -170,6 +171,7 @@ module.exports = class Simulator extends CocoClass
unless @options.headlessClient
simulatedBy = parseInt($('#simulated-by-you').text(), 10) + 1
$('#simulated-by-you').text(simulatedBy)
application.tracker?.trackEvent 'Simulator Result', label: "Success"
handleTaskResultsTransferError: (error) =>
@trigger 'statusUpdate', 'There was an error sending the results back to the server.'
@ -271,7 +273,8 @@ module.exports = class Simulator extends CocoClass
if spellTeam not in playerTeams then useProtectAPI = false
@spells[spellKey].thangs[thang.id].aether = @createAether @spells[spellKey].name, method, useProtectAPI
transpileSpell: (thang, spellKey, methodName) ->
transpileSpell: (thang, spellKey, methodName) ->
slugifiedThangID = _.string.slugify thang.id
generatedSpellKey = [slugifiedThangID,methodName].join '/'
source = @currentUserCodeMap[generatedSpellKey] ? ""
@ -335,10 +338,10 @@ class SimulationTask
getSpellKeyToTeamMap: -> @spellKeyToTeamMap
getPlayerTeams: -> _.pluck @rawData.sessions, 'team'
setWorld: (@world) ->
setWorld: (@world) ->
generateSpellKeyToSourceMap: ->
playerTeams = _.pluck @rawData.sessions, 'team'
spellKeyToSourceMap = {}
@ -362,7 +365,7 @@ class SimulationTask
teamCode[fullSpellName]=spell
_.merge spellKeyToSourceMap, teamCode
spellKeyToSourceMap
getWorldProgrammableSource: (desiredSpellKey ,world) ->
@ -382,5 +385,5 @@ class SimulationTask
@thangSpells[thang.id].push spellKey
if not method.cloneOf and spellKey is desiredSpellKey
console.log "Setting #{desiredSpellKey} from world!"
return method.source

View file

@ -38,6 +38,7 @@ module.exports = class SimulateTabView extends CocoView
# Simulations
onSimulateButtonClick: (e) ->
application.tracker?.trackEvent 'Simulate Button Click', {}
$("#simulate-button").prop "disabled", true
$("#simulate-button").text "Simulating..."

View file

@ -17,7 +17,7 @@ module.exports = class ProblemAlertView extends View
getRenderData: (context={}) ->
context = super context
format = (s) -> s?.replace('<', '&lt;').replace('>', '&gt;').replace("\n", "<br>")
format = (s) -> s?.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br>')
message = @problem.aetherProblem.message
age = @problem.aetherProblem.userInfo.age
if age?