mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
🐛Fix disappearing classroom student progress
JIT course instances were not getting the sessionsByUser mapping in some cases.
This commit is contained in:
parent
ee68229536
commit
d6694adb57
1 changed files with 6 additions and 3 deletions
|
@ -57,9 +57,10 @@ module.exports = class ClassroomView extends RootView
|
|||
courseInstance.sessionsByUser = {}
|
||||
@listenToOnce sessions, 'sync', (sessions) ->
|
||||
@sessions.add(sessions.slice())
|
||||
sessions.courseInstance.sessionsByUser = sessions.groupBy('creator')
|
||||
for courseInstance in @courseInstances.models
|
||||
courseInstance.sessionsByUser = courseInstance.sessions.groupBy('creator')
|
||||
|
||||
# generate course instance JIT, in the meantime have models w/out equivalents in the db
|
||||
# Generate course instance JIT, in the meantime have models w/out equivalents in the db
|
||||
for course in @courses.models
|
||||
query = {courseID: course.id, classroomID: @classroom.id}
|
||||
courseInstance = @courseInstances.findWhere(query)
|
||||
|
@ -120,14 +121,16 @@ module.exports = class ClassroomView extends RootView
|
|||
@listenToOnce modal, 'hidden', @render
|
||||
|
||||
userLastPlayedString: (user) ->
|
||||
return '' unless user.sessions?
|
||||
session = user.sessions.last()
|
||||
return '' if not session
|
||||
return '' unless session
|
||||
campaign = session.collection.campaign
|
||||
levelOriginal = session.get('level').original
|
||||
campaignLevel = campaign.get('levels')[levelOriginal]
|
||||
return "#{campaign.get('fullName')}, #{campaignLevel.name}"
|
||||
|
||||
userPlaytimeString: (user) ->
|
||||
return '' unless user.sessions?
|
||||
playtime = _.reduce user.sessions.pluck('playtime'), (s1, s2) -> (s1 or 0) + (s2 or 0)
|
||||
return '' unless playtime
|
||||
return moment.duration(playtime, 'seconds').humanize()
|
||||
|
|
Loading…
Reference in a new issue