Fix ClassroomView sparse progress handling

This commit is contained in:
Scott Erickson 2015-12-03 13:32:22 -08:00
parent afbfc69fd5
commit 3ac8f16d28
4 changed files with 19 additions and 14 deletions

View file

@ -11,3 +11,7 @@
.progress-bar
border-right: 1px solid grey
.progress-bar-default
background-color: white
color: grey

View file

@ -1,10 +1,11 @@
- var completed = session && session.get('state').complete;
h3 #{i + 1}. #{level.name.replace('Course: ', '')}
p
span.spr(data-i18n="courses.play_time")
span #{moment.duration(session.get('playtime'), "seconds").humanize()}
p
span.spr(data-i18n=completed ? "courses.completed" : "clans.last_played")
span #{moment(session.get('changed')).format('MMMM Do YYYY, h:mm:ss a')}
if canViewSolution
h3 #{i}. #{level.name.replace('Course: ', '')}
if session
p
span.spr(data-i18n="courses.play_time")
span #{moment.duration(session.get('playtime'), "seconds").humanize()}
p
span.spr(data-i18n=completed ? "courses.completed" : "clans.last_played")
span #{moment(session.get('changed')).format('MMMM Do YYYY, h:mm:ss a')}
if session && canViewSolution
strong(data-i18n=completed ? "clans.view_solution" : "clans.view_attempt")

View file

@ -69,16 +69,16 @@ block content
- var i = 0;
.progress
each level, levelID in campaign.get('levels')
- i++
- var session = sessionMap[levelID];
if !session
- break;
a(href=view.getLevelURL(level, course, courseInstance, session))
- var content = view.levelPopoverContent(level, session, i);
if session && session.get('state').complete
.progress-bar.progress-bar-success(style=css, data-content=content, data-toggle='popover')= i + 1
.progress-bar.progress-bar-success(style=css, data-content=content, data-toggle='popover')= i
else if session
.progress-bar.progress-bar-warning(style=css, data-content=content, data-toggle='popover')= i
else
.progress-bar.progress-bar-warning(style=css, data-content=content, data-toggle='popover')= i + 1
- i++
.progress-bar.progress-bar-default(style=css, data-content=content, data-toggle='popover')= i
else if paidFor
button.enable-btn.btn.btn-info.btn-sm(data-user-id=user.id, data-course-instance-cid=courseInstance.cid) Enable

View file

@ -163,7 +163,7 @@ module.exports = class ClassroomView extends RootView
@render()
levelPopoverContent: (level, session, i) ->
return null unless level and session
return null unless level
context = {
moment: moment
level: level