Simulator now pleads for you to help simulate when your match is being ranked.
This commit is contained in:
parent
b8dc4ed939
commit
8a5a45950f
7 changed files with 31 additions and 23 deletions
app
locale
styles/play/common
templates/play/common
views/play
server
|
@ -656,6 +656,7 @@
|
||||||
rank_submitted: "Submitted for Ranking"
|
rank_submitted: "Submitted for Ranking"
|
||||||
rank_failed: "Failed to Rank"
|
rank_failed: "Failed to Rank"
|
||||||
rank_being_ranked: "Game Being Ranked"
|
rank_being_ranked: "Game Being Ranked"
|
||||||
|
help_simulate: "Help simulate games?"
|
||||||
code_being_simulated: "Your new code is being simulated by other players for ranking. This will refresh as new matches come in."
|
code_being_simulated: "Your new code is being simulated by other players for ranking. This will refresh as new matches come in."
|
||||||
no_ranked_matches_pre: "No ranked matches for the "
|
no_ranked_matches_pre: "No ranked matches for the "
|
||||||
no_ranked_matches_post: " team! Play against some competitors and then come back here to get your game ranked."
|
no_ranked_matches_post: " team! Play against some competitors and then come back here to get your game ranked."
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
.ladder-submission-view
|
.ladder-submission-view
|
||||||
h3
|
.help-simulate
|
||||||
text-decoration: underline
|
font-weight: normal
|
||||||
|
float: right
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
button.btn.btn-success.rank-button
|
button.btn.btn-success.rank-button
|
||||||
span(data-i18n="ladder.rank_no_code").unavailable.hidden No New Code to Rank
|
span(data-i18n="ladder.rank_no_code").unavailable.secret No New Code to Rank
|
||||||
span(data-i18n="ladder.rank_my_game").rank.hidden Rank My Game!
|
span(data-i18n="ladder.rank_my_game").rank.secret Rank My Game!
|
||||||
span(data-i18n="ladder.rank_submitting").submitting.hidden Submitting...
|
span(data-i18n="ladder.rank_submitting").submitting.secret Submitting...
|
||||||
span(data-i18n="ladder.rank_submitted").submitted.hidden Submitted for Ranking
|
span(data-i18n="ladder.rank_submitted").submitted.secret Submitted for Ranking
|
||||||
span(data-i18n="ladder.rank_failed").failed.hidden Failed to Rank
|
span(data-i18n="ladder.rank_failed").failed.secret Failed to Rank
|
||||||
span(data-i18n="ladder.rank_being_ranked").ranking.hidden Game Being Ranked
|
span(data-i18n="ladder.rank_being_ranked").ranking.secret Game Being Ranked
|
||||||
|
|
||||||
|
a(href=simulateURL, data-i18n="ladder.help_simulate").help-simulate.secret Help simulate games?
|
|
@ -2,11 +2,12 @@ CocoView = require 'views/kinds/CocoView'
|
||||||
template = require 'templates/play/common/ladder_submission'
|
template = require 'templates/play/common/ladder_submission'
|
||||||
|
|
||||||
module.exports = class LadderSubmissionView extends CocoView
|
module.exports = class LadderSubmissionView extends CocoView
|
||||||
class: "ladder-submission-view"
|
className: "ladder-submission-view"
|
||||||
template: template
|
template: template
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click .rank-button': 'rankSession'
|
'click .rank-button': 'rankSession'
|
||||||
|
'click .help-simulate': 'onHelpSimulate'
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super options
|
super options
|
||||||
|
@ -16,9 +17,10 @@ module.exports = class LadderSubmissionView extends CocoView
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
ctx = super()
|
ctx = super()
|
||||||
ctx.readyToRank = @session?.readyToRank()
|
ctx.readyToRank = @session?.readyToRank()
|
||||||
ctx.isRanking = @ession?.get('isRanking')
|
ctx.isRanking = @session?.get('isRanking')
|
||||||
|
ctx.simulateURL = "/play/ladder/#{@level.get('slug')}#simulate"
|
||||||
ctx
|
ctx
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
return unless @supermodel.finished()
|
return unless @supermodel.finished()
|
||||||
|
@ -34,9 +36,11 @@ module.exports = class LadderSubmissionView extends CocoView
|
||||||
@setRankingButtonText rankingState
|
@setRankingButtonText rankingState
|
||||||
|
|
||||||
setRankingButtonText: (spanClass) ->
|
setRankingButtonText: (spanClass) ->
|
||||||
@rankButton.find('span').addClass('hidden')
|
@rankButton.find('span').hide()
|
||||||
@rankButton.find(".#{spanClass}").removeClass('hidden')
|
@rankButton.find(".#{spanClass}").show()
|
||||||
@rankButton.toggleClass 'disabled', spanClass isnt 'rank'
|
@rankButton.toggleClass 'disabled', spanClass isnt 'rank'
|
||||||
|
helpSimulate = spanClass in ['submitted', 'ranking']
|
||||||
|
@$el.find('.help-simulate').toggle(helpSimulate, 'slow')
|
||||||
|
|
||||||
rankSession: (e) ->
|
rankSession: (e) ->
|
||||||
return unless @session.readyToRank()
|
return unless @session.readyToRank()
|
||||||
|
@ -86,3 +90,5 @@ module.exports = class LadderSubmissionView extends CocoView
|
||||||
transpiledCode[thang][spellID] = aether.transpile spell
|
transpiledCode[thang][spellID] = aether.transpile spell
|
||||||
transpiledCode
|
transpiledCode
|
||||||
|
|
||||||
|
onHelpSimulate: ->
|
||||||
|
$('a[href="#simulate"]').tab('show')
|
||||||
|
|
|
@ -91,7 +91,7 @@ module.exports = class MyMatchesTabView extends CocoView
|
||||||
session = _.find @sessions.models, {id: sessionID}
|
session = _.find @sessions.models, {id: sessionID}
|
||||||
ladderSubmissionView = new LadderSubmissionView session: session, level: @level
|
ladderSubmissionView = new LadderSubmissionView session: session, level: @level
|
||||||
@insertSubView ladderSubmissionView, placeholder
|
@insertSubView ladderSubmissionView, placeholder
|
||||||
ladderSubmissionView.$el.find('.rank-button').addClass 'btn-block'
|
ladderSubmissionView.$el.find('.rank-button').addClass 'btn-block btn-lg'
|
||||||
|
|
||||||
@$el.find('.score-chart-wrapper').each (i, el) =>
|
@$el.find('.score-chart-wrapper').each (i, el) =>
|
||||||
scoreWrapper = $(el)
|
scoreWrapper = $(el)
|
||||||
|
|
|
@ -121,7 +121,7 @@ module.exports = class Handler
|
||||||
@modelClass.findOne(criteria, project).sort(sort).exec (err, document) ->
|
@modelClass.findOne(criteria, project).sort(sort).exec (err, document) ->
|
||||||
return done(err) if err
|
return done(err) if err
|
||||||
callback(null, document?.toObject() or null)
|
callback(null, document?.toObject() or null)
|
||||||
|
|
||||||
funcs = {}
|
funcs = {}
|
||||||
for id in ids
|
for id in ids
|
||||||
return errors.badInput(res, "Given an invalid id: #{id}") unless Handler.isID(id)
|
return errors.badInput(res, "Given an invalid id: #{id}") unless Handler.isID(id)
|
||||||
|
|
|
@ -103,7 +103,7 @@ module.exports.getTwoGames = (req, res) ->
|
||||||
#if userIsAnonymous req then return errors.unauthorized(res, "You need to be logged in to get games.")
|
#if userIsAnonymous req then return errors.unauthorized(res, "You need to be logged in to get games.")
|
||||||
humansGameID = req.body.humansGameID
|
humansGameID = req.body.humansGameID
|
||||||
ogresGameID = req.body.ogresGameID
|
ogresGameID = req.body.ogresGameID
|
||||||
|
|
||||||
unless ogresGameID and humansGameID
|
unless ogresGameID and humansGameID
|
||||||
#fetch random games here
|
#fetch random games here
|
||||||
return errors.badInput(res, "You need to supply two games(for now)")
|
return errors.badInput(res, "You need to supply two games(for now)")
|
||||||
|
@ -121,10 +121,10 @@ module.exports.getTwoGames = (req, res) ->
|
||||||
"transpiledCode": session.transpiledCode
|
"transpiledCode": session.transpiledCode
|
||||||
"teamSpells": session.teamSpells ? {}
|
"teamSpells": session.teamSpells ? {}
|
||||||
"levelID": session.levelID
|
"levelID": session.levelID
|
||||||
|
|
||||||
taskObject.sessions.push sessionInformation
|
taskObject.sessions.push sessionInformation
|
||||||
sendResponseObject req, res, taskObject
|
sendResponseObject req, res, taskObject
|
||||||
|
|
||||||
module.exports.createNewTask = (req, res) ->
|
module.exports.createNewTask = (req, res) ->
|
||||||
requestSessionID = req.body.session
|
requestSessionID = req.body.session
|
||||||
originalLevelID = req.body.originalLevelID
|
originalLevelID = req.body.originalLevelID
|
||||||
|
@ -214,7 +214,7 @@ fetchInitialSessionsToRankAgainst = (levelMajorVersion, levelID, submittedSessio
|
||||||
submittedCode:
|
submittedCode:
|
||||||
$exists: true
|
$exists: true
|
||||||
team: opposingTeam
|
team: opposingTeam
|
||||||
|
|
||||||
sortParameters =
|
sortParameters =
|
||||||
totalScore: 1
|
totalScore: 1
|
||||||
|
|
||||||
|
@ -663,9 +663,7 @@ retrieveOldSessionData = (sessionID, callback) ->
|
||||||
"totalScore":session.totalScore ? (25 - 1.8*(25/3))
|
"totalScore":session.totalScore ? (25 - 1.8*(25/3))
|
||||||
"id": sessionID
|
"id": sessionID
|
||||||
callback err, oldScoreObject
|
callback err, oldScoreObject
|
||||||
|
|
||||||
markSessionAsDoneRanking = (sessionID, cb) ->
|
markSessionAsDoneRanking = (sessionID, cb) ->
|
||||||
#console.log "Marking session as done ranking..."
|
#console.log "Marking session as done ranking..."
|
||||||
LevelSession.update {"_id":sessionID}, {"isRanking":false}, cb
|
LevelSession.update {"_id":sessionID}, {"isRanking":false}, cb
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue