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

Method nextLevelImage

app/views/courses/CoursesView.js:807–826  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

805 }
806
807 nextLevelImage () {
808 // Prioritize first by level-specific, then course-specific and hero-specific together
809 let course, hero, image
810 if (this._nextLevelImage) { return this._nextLevelImage }
811 if (!(course = this.nextLevelInfo != null ? this.nextLevelInfo.courseAcronym : undefined)) { return }
812 if (!(hero = this.hero.get('slug'))) { return }
813 const level = __guard__(this.nextLevelInfo != null ? this.nextLevelInfo.level : undefined, x => x.get('slug'))
814 const levelChoices = []
815 const courseChoices = []
816 const heroChoices = []
817 for (image in nextLevelBannerImages) {
818 const criteria = nextLevelBannerImages[image]
819 if (Array.from(criteria.levels != null ? criteria.levels : []).includes(level)) { levelChoices.push(image) }
820 if (Array.from(criteria.courses != null ? criteria.courses : []).includes(course)) { courseChoices.push(image) }
821 if (Array.from(criteria.heroes != null ? criteria.heroes : []).includes(hero)) { heroChoices.push(image) }
822 }
823 image = _.sample(levelChoices) || _.sample(heroChoices.concat(courseChoices))
824 this._nextLevelImage = '/images/pages/courses/banners/' + image
825 return this._nextLevelImage
826 }
827
828 aiLeagueTiles () {
829 const tiles = []

Callers

nothing calls this directly

Calls 2

__guard__Function · 0.70
getMethod · 0.45

Tested by

no test coverage detected