| 142 | } |
| 143 | |
| 144 | const success = nameMap => { |
| 145 | if (this.destroyed) { return } |
| 146 | for (session of Array.from(this.sessions.models)) { |
| 147 | matches = this.statsFromSession(session).matches || [] |
| 148 | for (match of Array.from(matches)) { |
| 149 | const opponent = match.opponents[0] |
| 150 | if (this.nameMap[opponent.userID]) { continue } |
| 151 | const opponentUser = nameMap[opponent.userID] |
| 152 | let name = opponentUser != null ? opponentUser.fullName : undefined |
| 153 | if (name) { name = name.replace(/^Anonymous/, $.i18n.t('play.anonymous')) } |
| 154 | if (!name) { |
| 155 | ({ |
| 156 | name |
| 157 | } = opponent) |
| 158 | } |
| 159 | if (!name) { name = '<bad match data>' } |
| 160 | name = name.replace(/^AIAlgorithm_(.+)_$/, '$1') |
| 161 | name = name.replace(/^AIYouth_(.+)_$/, '$1') |
| 162 | if (name.length > 21) { |
| 163 | name = name.substr(0, 18) + '...' |
| 164 | } |
| 165 | this.nameMap[opponent.userID] = name |
| 166 | } |
| 167 | } |
| 168 | if (this.supermodel.finished() && this.renderedOnce) { return this.render() } |
| 169 | } |
| 170 | |
| 171 | const data = { ids } |
| 172 | if (this.options.league) { |
nothing calls this directly
no test coverage detected