From 5e4d37716e3e72640e832e961f7cc0d38d4ec47b Mon Sep 17 00:00:00 2001 From: John Lee Date: Tue, 12 May 2015 13:18:07 -0400 Subject: [PATCH] Update the progress bar on the XBlock to show a full green bar when the user completes the module. We are simply scaling the progress bar to be full when mastery reaches 0.7, which is the cutoff for full credit. Any grade that is 0.7 or higher is simply just shown as a full bar. --- .../static/js/review_student_view.js | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/schoolyourself/static/js/review_student_view.js b/schoolyourself/static/js/review_student_view.js index 7130700..f6b049b 100644 --- a/schoolyourself/static/js/review_student_view.js +++ b/schoolyourself/static/js/review_student_view.js @@ -21,32 +21,30 @@ function SchoolYourselfReviewStudentView(runtime, element) { function renderMastery(masteries) { var mastery = masteries[0][1]; - var right = (100 - (mastery * 100)) + '%'; - var bg = '#ddd'; - if (!mastery) { + // A mastery level of 0.7 gives full credit -- anything beyond that + // doesn't count toward anything. So we should show a full, green bar + // when scaledMastery >= 0.7. + var scaledMastery = mastery / 0.7; + + var right = (100 - (scaledMastery * 100)) + '%'; + + var color = '#fcd380'; + if (!scaledMastery) { var text = 'Get started!'; - var color = '#fcd380'; - } else if (mastery < 0.35) { + } else if (scaledMastery < 0.5) { var text = 'Keep practicing!'; - var color = '#fcd380'; - } else if (mastery < 0.7) { + } else if (scaledMastery < 1) { var text = 'Almost there!'; var color = '#f0b300'; - } else if (mastery < 1) { - var text = 'Full credit!'; - var color = '#6eb535'; - var bg = '#a1d775'; } else { - var text = 'Mastered!'; + var text = 'Complete!'; var color = '#6eb535'; - var bg = '#a1d775'; } $('.schoolyourself-review-mastery-text').html(text); $('.schoolyourself-review-mastery-bar-filler').css('right', right); $('.schoolyourself-review-mastery-bar-filler').css('background', color); - $('.schoolyourself-review-mastery-bar').css('background', bg); } function updateMastery(masteryUrl) {