Skip to content

Commit

Permalink
number of selected execrises display correctly per topic
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanOXDi committed Feb 8, 2024
1 parent 3d905c9 commit 72feca2
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,18 @@
},
selectionMetadata(content) {
if (content.kind === ContentNodeKinds.TOPIC) {
const count = this.workingResourcePool.length;
const total = content.num_exercises;
return this.selectedResourcesInformation$({ count, total });
const numberOfresourcesSelected = this.workingResourcePool.reduce((acc, wr) => {
if (wr.ancestors.map(ancestor => ancestor.id).includes(content.id)) {
return acc + 1;
}
return acc;
}, 0);
return this.selectedResourcesInformation$({
count: numberOfresourcesSelected,
total: total,
});
}
return '';
},
Expand Down

0 comments on commit 72feca2

Please sign in to comment.