Add aggregate student progress to course details page

This commit is contained in:
Matt Lott 2015-07-30 15:30:36 -07:00
parent 14b4b83148
commit 59c730ef20
3 changed files with 32 additions and 1 deletions
app
styles/courses/mock1
templates/courses/mock1
views/courses/mock1

View file

@ -1,5 +1,17 @@
#course-details-view
.concept-completion-container
position: relative
.concept-completion-background
position: absolute
height: 100%
left: 0px
top: 0px
background-color: blue
opacity: 0.25
.concept-completed-foreground
font-size: 12pt
#editDescriptionModal .modal-dialog
background-color: white

View file

@ -5,7 +5,6 @@ block content
//- DO NOT localize / i18n
div TODO: fix ugly tabs
div TODO: aggregate student progress
div TODO: student level progress popups
div
span *UNDER CONSTRUCTION, send feedback to
@ -91,6 +90,18 @@ block content
if !studentMode
.tab-pane.active#progress(role='tabpanel')
if instance.students
h3 % Completed by Class
table.table.table-condensed
each concept in courseConcepts
- var conceptCompletion = Math.round(parseFloat(conceptsCompleted[concept]) / instance.students.length * 100)
if isNaN(conceptCompletion)
- conceptCompletion = 0
tr
td.concept-completion-container
span.concept-completed-foreground(data-i18n="concepts." + concept)
span.spl - #{conceptCompletion}%
span.concept-completion-background(style="width:#{conceptCompletion}%;")
br
table.table.table-condensed
thead
tr

View file

@ -39,6 +39,14 @@ module.exports = class CourseDetailsView extends RootView
context.userLevelStateMap = @userLevelStateMap ? {}
context.showExpandedProgress = @course.levels.length <= 30 or @showExpandedProgress
context.studentMode = @options.studentMode ? false
conceptsCompleted = {}
for user of context.userConceptsMap
for concept of context.userConceptsMap[user]
conceptsCompleted[concept] ?= 0
conceptsCompleted[concept]++
context.conceptsCompleted = conceptsCompleted
context
initData: ->