Add time played to level progress tooltips

This commit is contained in:
phoenixeliot 2016-06-03 10:18:41 -07:00
parent 7a0fb967f0
commit 0d5ad789e5
3 changed files with 13 additions and 2 deletions

View file

@ -156,6 +156,8 @@ module.exports =
courseProgress[levelID][userID] = { completed: true, started: false } # These don't matter, will always be set
session = _.find classroom.sessions.models, (session) ->
session.get('creator') is userID and session.get('level').original is levelID
courseProgress[levelID][userID].session = session
if not session # haven't gotten to this level yet, but might have completed others before
courseProgress.started ||= false #no-op

View file

@ -321,7 +321,7 @@ mixin studentLevelsRow(student)
- var levels = view.classroom.getLevels({courseID: course.id, withoutLadderLevels: true}).models
each level, index in levels
- var progress = state.get('progressData').get({ classroom: view.classroom, course: course, level: level, user: student })
+studentLevelProgressDot(progress, level, index+1)
+studentLevelProgressDot(progress, level, index+1, session)
mixin studentCourseProgressDot(progress, levelsTotal, level, label)
//- TODO: Refactor with TeacherClassesView jade
@ -342,7 +342,7 @@ mixin studentLevelProgressDot(progress, level, levelNumber)
//- TODO: Refactor with TeacherClassesView jade
- dotClass = progress.completed ? 'forest' : (progress.started ? 'gold' : '');
- levelName = level.get('name')
- context = _.merge(progress, { levelName: levelName, levelNumber: levelNumber })
- context = _.merge(progress, { levelName: levelName, levelNumber: levelNumber, moment: moment })
.progress-dot.level-progress-dot(class=dotClass, data-html='true', data-title=view.singleStudentLevelProgressDotTemplate(context))
+progressDotLabel(levelNumber)

View file

@ -1,3 +1,10 @@
mixin timePlayed()
if session.get('playtime') > 0
.small-details.nowrap
span.spr(data-i18n='teacher.time_played')
| Played for
span= moment.duration({ seconds: session.get('playtime') }).humanize()
if completed
.small-details.nowrap
span= levelNumber
@ -7,6 +14,7 @@ if completed
span.spr(data-i18n='teacher.completed')
| Completed
span= new Date(dateFirstCompleted).toLocaleString()
+timePlayed
//- .small-details
//- i(data-i18n='teacher.click_to_view_solution')
//- | click to view solution
@ -19,6 +27,7 @@ else if started
span.spr(data-i18n='teacher.last_played')
| Last played
span= new Date(lastPlayed).toLocaleString()
+timePlayed
//- .small-details
//- i(data-i18n='teacher.click_to_view_progress')
//- | click to view progress