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

Method success

app/views/ladder/MyMatchesTabView.js:144–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 2

statsFromSessionMethod · 0.95
renderMethod · 0.45

Tested by

no test coverage detected