Merge branch 'master' into production

This commit is contained in:
phoenixeliot 2016-08-02 13:46:14 -07:00
commit a4fcbadc76
4 changed files with 37 additions and 16 deletions

View file

@ -295,10 +295,27 @@ class ModelResource extends Resource
@model = modelOrCollection @model = modelOrCollection
@fetchOptions = fetchOptions @fetchOptions = fetchOptions
@jqxhr = @model.jqxhr @jqxhr = @model.jqxhr
@loadsAttempted = 0
load: -> load: ->
@markLoading() timeToWait = 5000
@fetchModel() tryLoad = =>
return if this.isLoaded
if @loadsAttempted > 4
@markFailed()
return @
@markLoading()
if @loadsAttempted > 0
console.log "Didn't load model in #{timeToWait}ms (attempt ##{@loadsAttempted}), trying again: ", this
@fetchModel()
@listenTo @model, 'error', (levelComponent, request) ->
if request.status isnt 504
clearTimeout(@timeoutID)
clearTimeout(@timeoutID) if @timeoutID
@timeoutID = setTimeout(tryLoad, timeToWait)
@loadsAttempted += 1
timeToWait *= 1.5
tryLoad()
@ @
fetchModel: -> fetchModel: ->

View file

@ -217,9 +217,10 @@ module.exports = class PlayLevelView extends RootView
# TODO: Update terminology to always be opponentSession or otherSession # TODO: Update terminology to always be opponentSession or otherSession
# TODO: E.g. if it's always opponent right now, then variable names should be opponentSession until we have coop play # TODO: E.g. if it's always opponent right now, then variable names should be opponentSession until we have coop play
@otherSession = @levelLoader.opponentSession @otherSession = @levelLoader.opponentSession
@worldLoadFakeResources = [] # first element (0) is 1%, last (99) is 100% unless @level.isType('game-dev')
for percent in [1 .. 100] @worldLoadFakeResources = [] # first element (0) is 1%, last (99) is 100%
@worldLoadFakeResources.push @supermodel.addSomethingResource 1 for percent in [1 .. 100]
@worldLoadFakeResources.push @supermodel.addSomethingResource 1
@renderSelectors '#stop-real-time-playback-button' @renderSelectors '#stop-real-time-playback-button'
onWorldLoadProgressChanged: (e) -> onWorldLoadProgressChanged: (e) ->
@ -570,7 +571,7 @@ module.exports = class PlayLevelView extends RootView
ModalClass = CourseVictoryModal if @isCourseMode() or me.isSessionless() ModalClass = CourseVictoryModal if @isCourseMode() or me.isSessionless()
if @level.isType('course-ladder') if @level.isType('course-ladder')
ModalClass = CourseVictoryModal ModalClass = CourseVictoryModal
options.courseInstanceID = @getQueryVariable 'league' options.courseInstanceID = @getQueryVariable 'course-instance' or @getQueryVariable 'league'
ModalClass = PicoCTFVictoryModal if window.serverConfig.picoCTF ModalClass = PicoCTFVictoryModal if window.serverConfig.picoCTF
victoryModal = new ModalClass(options) victoryModal = new ModalClass(options)
@openModalView(victoryModal) @openModalView(victoryModal)

View file

@ -14,7 +14,7 @@ module.exports = class CourseVictoryModal extends ModalView
initialize: (options) -> initialize: (options) ->
@courseID = options.courseID @courseID = options.courseID
@courseInstanceID = options.courseInstanceID @courseInstanceID = options.courseInstanceID or @getQueryVariable 'course-instance' or @getQueryVariable 'league'
@views = [] @views = []
@session = options.session @session = options.session

View file

@ -64,10 +64,8 @@ var courses =
slug: "game-dev-1", slug: "game-dev-1",
campaignID: ObjectId("5789236960deed1f00ec2ab8"), campaignID: ObjectId("5789236960deed1f00ec2ab8"),
description: "Learn to create your owns games which you can share with your friends.", description: "Learn to create your owns games which you can share with your friends.",
duration: NumberInt(5), duration: NumberInt(1),
free: false, free: false,
//screenshot: "/images/pages/courses/105_info.png",
adminOnly: true, // Until we finish transitioning to releasePhase
releasePhase: 'beta' releasePhase: 'beta'
}, },
{ {
@ -75,10 +73,8 @@ var courses =
slug: "web-dev-1", slug: "web-dev-1",
campaignID: ObjectId("578913f2c8871ac2326fa3e4"), campaignID: ObjectId("578913f2c8871ac2326fa3e4"),
description: "Learn the basics of web development in this introductory HTML & CSS course.", description: "Learn the basics of web development in this introductory HTML & CSS course.",
duration: NumberInt(5), duration: NumberInt(1),
free: false, free: false,
//screenshot: "/images/pages/courses/105_info.png",
adminOnly: true, // Until we finish transitioning to releasePhase
releasePhase: 'beta' releasePhase: 'beta'
}, },
{ {
@ -86,10 +82,17 @@ var courses =
slug: "web-dev-2", slug: "web-dev-2",
campaignID: ObjectId("57891570c8871ac2326fa3f8"), campaignID: ObjectId("57891570c8871ac2326fa3f8"),
description: "Learn more advanced web development, including scripting to make interactive webpages.", description: "Learn more advanced web development, including scripting to make interactive webpages.",
duration: NumberInt(5), duration: NumberInt(2),
free: false,
releasePhase: 'beta'
},
{
name: "JS Primer",
slug: "js-primer",
campaignID: ObjectId("579a5f37843ad12000e6d4c7"),
description: "Learn JavaScript after you already know another programming language like Python.",
duration: NumberInt(1),
free: false, free: false,
//screenshot: "/images/pages/courses/105_info.png",
adminOnly: true, // Until we finish transitioning to releasePhase
releasePhase: 'beta' releasePhase: 'beta'
} }
]; ];