()
| 560 | } |
| 561 | |
| 562 | onCoursesSync () { |
| 563 | return |
| 564 | this.courses.remove(this.courses.findWhere({ releasePhase: 'beta' })) |
| 565 | const sortedCourses = utils.sortCourses(this.courses.models != null ? this.courses.models : []) |
| 566 | this.courseOrderMap = {} |
| 567 | for (let i = 0, end = sortedCourses.length, asc = end >= 0; asc ? i < end : i > end; asc ? i++ : i--) { this.courseOrderMap[sortedCourses[i].get('_id')] = i } |
| 568 | |
| 569 | let startDay = new Date() |
| 570 | startDay.setUTCDate(startDay.getUTCDate() - this.furthestCourseDayRange) |
| 571 | startDay = startDay.toISOString().substring(0, 10) |
| 572 | const options = { |
| 573 | url: '/db/course_instance/-/recent', |
| 574 | method: 'POST', |
| 575 | data: { startDay } |
| 576 | } |
| 577 | options.error = (models, response, options) => { |
| 578 | if (this.destroyed) { return } |
| 579 | return console.error('Failed to get recent course instances', response) |
| 580 | } |
| 581 | options.success = data => { |
| 582 | this.onCourseInstancesSync(data) |
| 583 | return (typeof this.renderSelectors === 'function' ? this.renderSelectors('#furthest-course') : undefined) |
| 584 | } |
| 585 | return this.supermodel.addRequestResource(options, 0).load() |
| 586 | } |
| 587 | |
| 588 | onCourseInstancesSync (data) { |
| 589 | this.courseDistributionsRecent = [] |
nothing calls this directly
no test coverage detected