()
| 109 | // PART 2: Loading the names of the other users |
| 110 | |
| 111 | loadNames () { |
| 112 | let challenger |
| 113 | this.challengers = this.getChallengers() |
| 114 | const ids = ((() => { |
| 115 | const result = [] |
| 116 | for (challenger of _.values(this.challengers)) { |
| 117 | result.push(challenger.opponentID) |
| 118 | } |
| 119 | return result |
| 120 | })()) |
| 121 | |
| 122 | for (challenger of _.values(this.challengers)) { |
| 123 | if (!challenger || !this.wizardType.loaded) { continue } |
| 124 | if ((!challenger.opponentImageSource) && challenger.opponentWizard?.colorConfig) { |
| 125 | challenger.opponentImageSource = this.wizardType.getPortraitSource( |
| 126 | { colorConfig: challenger.opponentWizard.colorConfig }) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | const success = nameMap => { |
| 131 | // it seems to be fix that could go to both |
| 132 | this.nameMap = nameMap |
| 133 | if (this.destroyed) { return } |
| 134 | for (challenger of _.values(this.challengers)) { |
| 135 | challenger.opponentName = this.nameMap[challenger.opponentID]?.fullName || this.nameMap[challenger.opponentID]?.name || 'Anonymous' |
| 136 | challenger.opponentWizard = this.nameMap[challenger.opponentID]?.wizard || {} |
| 137 | } |
| 138 | return this.checkWizardLoaded() |
| 139 | } |
| 140 | |
| 141 | const data = { ids, wizard: true } |
| 142 | if (this.options.league) { |
| 143 | data.leagueId = this.options.league.id |
| 144 | } |
| 145 | const userNamesRequest = this.supermodel.addRequestResource('user_names', { |
| 146 | url: '/db/user/-/getFullNames', |
| 147 | data, |
| 148 | method: 'POST', |
| 149 | success |
| 150 | }, 0) |
| 151 | return userNamesRequest.load() |
| 152 | } |
| 153 | |
| 154 | // PART 3: Make sure wizard is loaded |
| 155 |
no test coverage detected