mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Fix: Some level systems load forever.
This commit is contained in:
parent
692693c181
commit
375aca2c0a
4 changed files with 15 additions and 15 deletions
|
@ -11,6 +11,14 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
@collections = {}
|
||||
@schemas = {}
|
||||
|
||||
# setInterval(@checkModelStatus, 5000)
|
||||
|
||||
# For debugging
|
||||
checkModelStatus: =>
|
||||
for key, res of @resources
|
||||
continue if res.isLoaded
|
||||
console.debug 'resource ' + res.name + ' is still loading'
|
||||
|
||||
populateModel: (model, resName) ->
|
||||
@mustPopulate = model
|
||||
model.saveBackups = @shouldSaveBackups(model)
|
||||
|
@ -222,15 +230,6 @@ class ModelResource extends Resource
|
|||
|
||||
fetchModel: ->
|
||||
@model.fetch(@fetchOptions)
|
||||
|
||||
###
|
||||
setTimeout(=>
|
||||
if @isLoading
|
||||
@markLoaded()
|
||||
@loadDeferred.resolve(@)
|
||||
console.debug 'gintau', 'load-timeout'
|
||||
, 5000)
|
||||
###
|
||||
|
||||
@listenToOnce(@model, 'sync', ->
|
||||
@markLoaded()
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = class JobProfileView extends CocoView
|
|||
|
||||
afterRender: ->
|
||||
super()
|
||||
return if @loading()
|
||||
return unless @supermodel.finished()
|
||||
_.defer => @buildJobProfileTreema() # Not sure why, but the Treemas don't fully build without this if you reload the page.
|
||||
|
||||
buildJobProfileTreema: ->
|
||||
|
|
|
@ -33,9 +33,10 @@ module.exports = class SystemsTabView extends View
|
|||
ls = new LevelSystem()
|
||||
ls.saveBackups = true
|
||||
lsRes = @supermodel.addModelResource(ls, 'level_system_' + system.original)
|
||||
lsRes.load()
|
||||
|
||||
do (url) -> ls.url = -> url
|
||||
continue if @supermodel.getModelByURL ls.url
|
||||
lsRes.load()
|
||||
@listenToOnce(lsRes, 'resource:loaded', @onSystemLoaded)
|
||||
++@toLoad
|
||||
@onDefaultSystemsLoaded() unless @toLoad
|
||||
|
|
|
@ -36,7 +36,7 @@ module.exports = class LadderTabView extends CocoView
|
|||
|
||||
constructor: (options, @level, @sessions) ->
|
||||
super(options)
|
||||
@socialNetworkRes = @supermodel.addSomethingResource("social_network_apis")
|
||||
@socialNetworkRes = @supermodel.addSomethingResource("social_network_apis", 0)
|
||||
|
||||
@teams = teamDataFromLevel @level
|
||||
@leaderboards = {}
|
||||
|
@ -49,7 +49,7 @@ module.exports = class LadderTabView extends CocoView
|
|||
|
||||
# @addSomethingToLoad("facebook_status")
|
||||
|
||||
@fbStatusRes = @supermodel.addSomethingResource("facebook_status")
|
||||
@fbStatusRes = @supermodel.addSomethingResource("facebook_status", 0)
|
||||
@fbStatusRes.load()
|
||||
|
||||
FB.getLoginStatus (response) =>
|
||||
|
@ -75,7 +75,7 @@ module.exports = class LadderTabView extends CocoView
|
|||
loadFacebookFriends: ->
|
||||
# @addSomethingToLoad("facebook_friends")
|
||||
|
||||
@fbFriendRes = @supermodel.addSomethingResource("facebook_friends")
|
||||
@fbFriendRes = @supermodel.addSomethingResource("facebook_friends", 0)
|
||||
@fbFriendRes.load()
|
||||
|
||||
FB.api '/me/friends', @onFacebookFriendsLoaded
|
||||
|
@ -128,7 +128,7 @@ module.exports = class LadderTabView extends CocoView
|
|||
gplusSessionStateLoaded: ->
|
||||
if application.gplusHandler.loggedIn
|
||||
#@addSomethingToLoad("gplus_friends")
|
||||
@gpFriendRes = @supermodel.addSomethingResource("gplus_friends")
|
||||
@gpFriendRes = @supermodel.addSomethingResource("gplus_friends", 0)
|
||||
@gpFriendRes.load()
|
||||
application.gplusHandler.loadFriends @gplusFriendsLoaded
|
||||
|
||||
|
|
Loading…
Reference in a new issue