CourseDetailsView does not link to next course if the student is not assigned to that course

This commit is contained in:
Scott Erickson 2016-05-18 17:03:49 -07:00
parent a89782b9c6
commit 184be0bf65
2 changed files with 3 additions and 1 deletions
app
templates/courses
views/courses

View file

@ -65,7 +65,7 @@ block content
span= view.course.get('name')
span .
.col-md-6
if view.nextCourseInstance
if view.nextCourseInstance && _.contains(view.nextCourseInstance.get('members'), me.id)
a.btn.btn-lg.btn-success(href="/courses/#{view.nextCourse.id}/#{view.nextCourseInstance.id}")
h1= view.nextCourse.get('name')
p= view.nextCourse.get('description')

View file

@ -62,6 +62,8 @@ module.exports = class CourseDetailsView extends RootView
# need to figure out the next course instance
@courseComplete = true
@courseInstances.comparator = 'courseID'
# TODO: make this logic use locked course content to figure out the next course, then fetch the
# course instance for that
@supermodel.trackRequest(@courseInstances.fetchForClassroom(classroomID).then(=>
@nextCourseInstance = _.find @courseInstances.models, (ci) => ci.get('courseID') > @courseID
if @nextCourseInstance