mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(client): stop double-counting completed challenges (#57985)
This commit is contained in:
committed by
GitHub
parent
0979ab4eba
commit
67a7c3254a
@@ -281,9 +281,9 @@ export const SuperBlockAccordion = ({
|
||||
});
|
||||
|
||||
const chapterStepIdsSet = new Set(chapterStepIds);
|
||||
const completedStepsInChapter = completedChallengeIds.filter(id =>
|
||||
chapterStepIdsSet.has(id)
|
||||
);
|
||||
const completedStepsInChapter = new Set(
|
||||
completedChallengeIds.filter(id => chapterStepIdsSet.has(id))
|
||||
).size;
|
||||
|
||||
return (
|
||||
<Chapter
|
||||
@@ -291,7 +291,7 @@ export const SuperBlockAccordion = ({
|
||||
dashedName={chapter.name}
|
||||
isExpanded={expandedChapter === chapter.name}
|
||||
totalSteps={chapterStepIds.length}
|
||||
completedSteps={completedStepsInChapter.length}
|
||||
completedSteps={completedStepsInChapter}
|
||||
>
|
||||
{chapter.modules.map(module => {
|
||||
// show coming soon on production, and all the challenges in dev
|
||||
@@ -321,9 +321,9 @@ export const SuperBlockAccordion = ({
|
||||
);
|
||||
|
||||
const moduleStepIdsSet = new Set(moduleStepIds);
|
||||
const completedStepsInModule = completedChallengeIds.filter(id =>
|
||||
moduleStepIdsSet.has(id)
|
||||
);
|
||||
const completedStepsInModule = new Set(
|
||||
completedChallengeIds.filter(id => moduleStepIdsSet.has(id))
|
||||
).size;
|
||||
|
||||
return (
|
||||
<Module
|
||||
@@ -331,7 +331,7 @@ export const SuperBlockAccordion = ({
|
||||
dashedName={module.name}
|
||||
isExpanded={expandedModule === module.name}
|
||||
totalSteps={moduleStepIds.length}
|
||||
completedSteps={completedStepsInModule.length}
|
||||
completedSteps={completedStepsInModule}
|
||||
>
|
||||
{module.blocks.map(block => (
|
||||
// maybe TODO: allow blocks to be "coming soon"
|
||||
|
||||
Reference in New Issue
Block a user