MCPcopy Index your code
hub / github.com/codecombat/codecombat / constructor

Method constructor

app/views/ladder/MainTournamentView.js:63–93  ·  view source on GitHub ↗
(options, pageType, objectId)

Source from the content-addressed store, hash-verified

61 }
62
63 constructor (options, pageType, objectId) {
64 super(options)
65 let url
66 this.pageType = pageType
67 this.objectId = objectId
68 this.ladderLevels = []
69 this.ladderImageMap = {}
70 this.tournaments = []
71
72 if (this.pageType === 'clan') {
73 url = `/db/tournaments?clanId=${this.objectId}`
74 this.clan = this.supermodel.loadModel(new Clan({ _id: this.objectId })).model
75 this.clan.once('sync', clan => {
76 console.log(clan, this.clan)
77 return this.renderSelectors('#ladder-list')
78 })
79 } else if (this.pageType === 'student') { // deprecated
80 url = `/db/tournaments?memberId=${this.objectId}`
81 }
82 const tournaments = new CocoCollection([], { url, model: Tournament })
83 this.listenTo(tournaments, 'sync', () => {
84 this.tournaments = (Array.from(tournaments.models).map((t) => t.toJSON()))[0]
85 return (typeof this.render === 'function' ? this.render() : undefined)
86 })
87 this.supermodel.loadCollection(tournaments, 'tournaments', { cache: false })
88
89 this.editableTournament = {}
90
91 this.ladders = this.supermodel.loadCollection(new LadderCollection()).model
92 this.listenToOnce(this.ladders, 'sync', this.onLaddersLoaded)
93 }
94
95 getMeta () {
96 return { title: $.i18n.t('ladder.title') }

Callers

nothing calls this directly

Calls 2

logMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected