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

Method calculateStats

app/views/user/CertificatesView.js:166–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164 }
165
166 calculateStats () {
167 if (!this.classroom.loaded || !this.sessions.loaded || !this.courseLevels.loaded) { return }
168 this.courseStats = this.classroom.statsForSessions(this.sessions, this.course.id, this.courseLevels)
169
170 if (this.courseStats.levels.project) {
171 const projectSession = this.sessions.find(session => session.get('level').original === this.courseStats.levels.project.get('original'))
172 if (projectSession) {
173 this.projectLink = `${window.location.origin}/play/${this.courseStats.levels.project.get('type')}-level/${projectSession.id}`
174 return fetchJson('/db/level.session/short-link', { method: 'POST', json: { url: this.projectLink } }).then(response => {
175 this.projectShortLink = response.shortLink
176 return this.render()
177 })
178 }
179 }
180 }
181
182 calculateCourseStats () {
183 let playtime = 0

Callers 1

onClassroomLoadedMethod · 0.95

Calls 3

statsForSessionsMethod · 0.80
getMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected