MCPcopy Create free account
hub / github.com/codecombat/codecombat / onLoaded

Method onLoaded

app/views/editor/level/LevelEditView.js:177–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175 }
176
177 onLoaded () {
178 _.defer(() => {
179 this.setMeta(this.getMeta())
180 this.world = this.levelLoader.world
181 this.render()
182 this.timerIntervalID = setInterval(this.incrementBuildTime, 1000)
183 if (this.level.get('original')) {
184 this.checkPresenceIntervalID = setInterval(this.checkPresence, 15000)
185 this.checkPresence()
186 if (me.isAdmin()) {
187 presenceApi.setPresence({ levelOriginalId: this.level.get('original') })
188 }
189 }
190 })
191
192 const campaignCourseMap = {}
193 for (const course of Array.from(this.courses.models)) { campaignCourseMap[course.get('campaignID')] = course.id }
194 for (const campaign of Array.from(this.campaigns.models)) {
195 const object = campaign.get('levels')
196 for (const levelID in object) {
197 const level = object[levelID]
198 if (levelID === this.level.get('original')) {
199 this.courseID = campaignCourseMap[campaign.id]
200 }
201 }
202 if (this.courseID) { break }
203 }
204 if (!this.courseID && (me.isAdmin() || me.isArtisan())) {
205 // Give it a fake course ID so we can test it in course mode before it's in a course.
206 this.courseID = '560f1a9f22961295f9427742'
207 }
208 this.getLevelCompletionRate()
209 }
210
211 getRenderData (context) {
212 let left

Callers

nothing calls this directly

Calls 7

getMetaMethod · 0.95
checkPresenceMethod · 0.95
isAdminMethod · 0.80
isArtisanMethod · 0.80
renderMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected