(e)
| 261 | } |
| 262 | |
| 263 | onClickEnableButton (e) { |
| 264 | const $button = $(e.target).closest('.btn') |
| 265 | const courseInstance = this.courseInstances.get($button.data('course-instance-cid')) |
| 266 | console.log('looking for course instance', courseInstance, 'for', $button.data('course-instance-cid'), 'out of', this.courseInstances) |
| 267 | const userID = $button.data('user-id') |
| 268 | $button.attr('disabled', true) |
| 269 | if (application.tracker != null) { |
| 270 | application.tracker.trackEvent('Course assign student', { category: 'Courses', courseInstanceID: courseInstance.id, userID }) |
| 271 | } |
| 272 | |
| 273 | const onCourseInstanceCreated = () => { |
| 274 | courseInstance.addMember(userID) |
| 275 | return this.listenToOnce(courseInstance, 'sync', this.render) |
| 276 | } |
| 277 | |
| 278 | if (courseInstance.isNew()) { |
| 279 | // adding the first student to this course, so generate the course instance for it |
| 280 | if (!courseInstance.saving) { |
| 281 | courseInstance.save(null, { validate: false }) |
| 282 | courseInstance.saving = true |
| 283 | } |
| 284 | return courseInstance.once('sync', onCourseInstanceCreated) |
| 285 | } else { |
| 286 | return onCourseInstanceCreated() |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | // TODO: update newly visible level progress bar (currently all white) |
| 291 |
nothing calls this directly
no test coverage detected