From 67a7c3254a9753ffa329b01fe227097f9c2a4a47 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Wed, 8 Jan 2025 17:07:35 +0100 Subject: [PATCH] fix(client): stop double-counting completed challenges (#57985) --- .../components/super-block-accordion.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/templates/Introduction/components/super-block-accordion.tsx b/client/src/templates/Introduction/components/super-block-accordion.tsx index e4eca7ba173..e59818d8d27 100644 --- a/client/src/templates/Introduction/components/super-block-accordion.tsx +++ b/client/src/templates/Introduction/components/super-block-accordion.tsx @@ -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.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.blocks.map(block => ( // maybe TODO: allow blocks to be "coming soon"