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

Method getLevelPlayCounts

app/views/ladder/MainLadderView.js:64–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 }
63
64 getLevelPlayCounts () {
65 const success = levelPlayCounts => {
66 if (this.destroyed) { return }
67 for (const level of Array.from(levelPlayCounts)) {
68 this.levelPlayCountMap[level._id] = { playtime: level.playtime, sessions: level.sessions }
69 }
70 if (this.supermodel.finished()) { return this.render() }
71 }
72
73 const levelIDs = []
74 for (const campaign of Array.from(campaigns)) {
75 for (const level of Array.from(campaign.levels)) {
76 levelIDs.push(level.id)
77 }
78 }
79 const levelPlayCountsRequest = this.supermodel.addRequestResource('play_counts', {
80 url: '/db/level/-/play_counts',
81 data: { ids: levelIDs },
82 method: 'POST',
83 success
84 }, 0)
85 return levelPlayCountsRequest.load()
86 }
87 }
88 MainLadderView.initClass()
89 return MainLadderView

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected