| 28 | } |
| 29 | |
| 30 | constructor (options, levelSlug) { |
| 31 | super(options) |
| 32 | blocklyUtils.registerBlocklyTheme() |
| 33 | blocklyUtils.initializeBlocklyTooltips() |
| 34 | this.focusTest = utils.getQueryVariable('test') |
| 35 | this.focusLanguage = utils.getQueryVariable('codeLanguage') |
| 36 | this.focusCampaign = utils.getQueryVariable('campaign') |
| 37 | this.testSkip = parseInt(utils.getQueryVariable('skip', 0), 10) |
| 38 | this.testLimit = parseInt(utils.getQueryVariable('limit', 100)) |
| 39 | this.blocklyWorkspaces = [] |
| 40 | |
| 41 | if (!levelTestsAdded && (!this.focusTest || !(/^Level - /.test(this.focusTest)))) { |
| 42 | this.campaigns = storage.load('blockly-test-campaigns') |
| 43 | if (this.campaigns) { |
| 44 | this.onLoaded() |
| 45 | } else { |
| 46 | this.campaignsCollection = new Campaigns() |
| 47 | this.supermodel.trackRequest(this.campaignsCollection.fetch({ data: { project: 'slug,type,levels' } })) |
| 48 | this.campaignsCollection.comparator = m => [ |
| 49 | 'intro', 'course-2', 'course-3', 'course-4', 'course-5', 'course-6', |
| 50 | 'dungeon', 'forest', 'desert', 'mountain', 'glacier', 'volcano', |
| 51 | 'campaign-game-dev-1', 'game-dev-1', 'campaign-game-dev-2', 'game-dev-2', 'campaign-game-dev-3', 'game-dev-3', |
| 52 | 'hoc-2018', 'game-dev-hoc', 'game-dev-hoc-2', 'ai-league-hoc'].indexOf(m.get('slug')) |
| 53 | } |
| 54 | } else { |
| 55 | this.onLoaded() |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | onLoaded () { |
| 60 | super.onLoaded() |