mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-12 16:51:35 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
0bddd45e97
2 changed files with 9 additions and 1 deletions
|
@ -52,7 +52,9 @@ module.exports =
|
||||||
classroomMap[classroom.id] = classroom for classroom in classrooms
|
classroomMap[classroom.id] = classroom for classroom in classrooms
|
||||||
levelOriginal = level.get('original')
|
levelOriginal = level.get('original')
|
||||||
for courseInstance in courseInstances
|
for courseInstance in courseInstances
|
||||||
classroom = classroomMap[courseInstance.get('classroomID').toString()]
|
classroomID = courseInstance.get('classroomID')
|
||||||
|
continue unless classroomID
|
||||||
|
classroom = classroomMap[classroomID.toString()]
|
||||||
courseID = courseInstance.get('courseID')
|
courseID = courseInstance.get('courseID')
|
||||||
classroomCourse = _.find(classroom.get('courses'), (c) -> c._id.equals(courseID))
|
classroomCourse = _.find(classroom.get('courses'), (c) -> c._id.equals(courseID))
|
||||||
for courseLevel in classroomCourse.levels
|
for courseLevel in classroomCourse.levels
|
||||||
|
|
|
@ -80,6 +80,12 @@ describe 'GET /db/level/:handle/session', ->
|
||||||
expect(res.statusCode).toBe(200)
|
expect(res.statusCode).toBe(200)
|
||||||
expect(body.codeLanguage).toBe('python')
|
expect(body.codeLanguage).toBe('python')
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
it 'does not break if the user has a courseInstance without an associated classroom', utils.wrap (done) ->
|
||||||
|
yield @courseInstance.update({$unset: {classroomID: ''}})
|
||||||
|
[res, body] = yield request.getAsync { uri: @url, json: true }
|
||||||
|
expect(res.statusCode).toBe(402)
|
||||||
|
done()
|
||||||
|
|
||||||
it 'returns 402 if the user is not in a course with that level', utils.wrap (done) ->
|
it 'returns 402 if the user is not in a course with that level', utils.wrap (done) ->
|
||||||
otherStudent = yield utils.initUser({role: 'student'})
|
otherStudent = yield utils.initUser({role: 'student'})
|
||||||
|
|
Loading…
Reference in a new issue