Index: lams_learning/web/includes/javascript/learnerPage.js
===================================================================
diff -u -rb61438aa2b38fbabbc39cceb7f6b45973a682557 -r722eca5a525f8ec6f93a1f8c740473a68876f1c1
--- lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision b61438aa2b38fbabbc39cceb7f6b45973a682557)
+++ lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision 722eca5a525f8ec6f93a1f8c740473a68876f1c1)
@@ -37,7 +37,8 @@
});
}
- let progressBarItems = $('.component-page-wrapper .component-sidebar #progress-bar-items').empty();
+ let progressBarItems = $('.component-page-wrapper .component-sidebar #progress-bar-items').empty(),
+ completedActivityCount = 0;
$.each(result.activities, function (activityIndex, activityData) {
let activityItem = $('
').attr('role', 'navigation menubaritem').appendTo(progressBarItems),
activityName = !activityData.name && activityData.type === 'g' ? 'Gate' : activityData.name,
@@ -51,6 +52,8 @@
activityIcon.addClass('fa-circle');
}
} else if (activityData.status === 1) {
+ completedActivityCount++;
+
activityItem.addClass('progress-bar-item-complete').prepend(activityIcon);
if (activityData.type === 'g') {
activityIcon.addClass('fa-hourglass-full');
@@ -75,6 +78,13 @@
}
}
});
+
+ let progressBarWidgetValue = Math.round(completedActivityCount / result.activities.length * 100),
+ progressBarWidget = $('.component-page-wrapper .component-page-content #progress-bar-widget');
+ $('.progress-bar', progressBarWidget)
+ .css('width', progressBarWidgetValue + '%')
+ .attr('aria-valuenow', progressBarWidgetValue);
+ $('#progress-bar-widget-value').text(progressBarWidgetValue + '%');
}
});
}
\ No newline at end of file