Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Return correct calculation for presentation components with items (fixes #228) #229

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion js/PageLevelProgressIndicatorView.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ class PageLevelProgressIndicatorView extends Backbone.View {

calculatePercentage() {
const isPresentationComponentWithItems = (!this.model.isTypeGroup('question') && this.model instanceof ItemsComponentModel);
const isComplete = this.model.get('_isComplete');
swashbuck marked this conversation as resolved.
Show resolved Hide resolved
if (isComplete) return 100;
if (isPresentationComponentWithItems) {
const children = this.model.getChildren();
const visited = children.filter(child => child.get('_isVisited'));
return Math.round(visited.length / children.length * 100);
}
return this.model.get('_isComplete') ? 100 : 0;
return 0
}

render() {
Expand Down