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

Method afterRender

app/views/ladder/MyMatchesTabView.js:184–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182 }
183
184 afterRender () {
185 super.afterRender()
186 this.renderedOnce = true
187 for (const key in this.subviews) { const subview = this.subviews[key]; if (subview instanceof LadderSubmissionView) { this.removeSubView(subview) } }
188 this.$el.find('.ladder-submission-view').each((i, el) => {
189 let mirrorSession
190 const placeholder = $(el)
191 const sessionID = placeholder.data('session-id')
192 const session = _.find(this.sessions.models, { id: sessionID })
193 if (this.level.get('mirrorMatch')) {
194 mirrorSession = ((() => {
195 const result = []
196 for (const s of Array.from(this.sessions.models)) {
197 if (s.get('team') !== session.get('team')) {
198 result.push(s)
199 }
200 }
201 return result
202 })())[0]
203 }
204 const ladderSubmissionView = new LadderSubmissionView({ session, level: this.level, mirrorSession })
205 this.insertSubView(ladderSubmissionView, placeholder)
206 if ((session != null ? session.readyToRank() : undefined) && utils.getQueryVariable('submit') && !this.initiallyAutoSubmitted) {
207 this.initiallyAutoSubmitted = true
208 ladderSubmissionView.rankSession()
209 return this.openShareLadderLinkModal()
210 }
211 }) // todo: check conflict with #play modal
212
213 this.$el.find('.score-chart-wrapper').each((i, el) => {
214 const scoreWrapper = $(el)
215 const team = _.find(this.teams, { name: scoreWrapper.data('team-name') })
216 return this.generateScoreLineChart(scoreWrapper.attr('id'), team.scoreHistory, team.name)
217 })
218
219 return this.$el.find('tr.fresh').removeClass('fresh', 5000)
220 }
221
222 openShareLadderLinkModal (e) {
223 let session

Callers

nothing calls this directly

Calls 6

rankSessionMethod · 0.95
dataMethod · 0.80
readyToRankMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected