| 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 = [] |