()
| 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 |
no test coverage detected