Skip to content

fix(client): filter challenge nodes by certification to fix progress bar#67052

Open
ragini-pandey wants to merge 1 commit intofreeCodeCamp:mainfrom
ragini-pandey:fix/progress-bar-shared-blocks-js-v9
Open

fix(client): filter challenge nodes by certification to fix progress bar#67052
ragini-pandey wants to merge 1 commit intofreeCodeCamp:mainfrom
ragini-pandey:fix/progress-bar-shared-blocks-js-v9

Conversation

@ragini-pandey
Copy link
Copy Markdown
Contributor

Checklist:

Closes #67048

Problem

The progress bar after completing a challenge in the JavaScript v9 curriculum only fills to ~50% maximum (e.g. shows 7% for 1 out of 7 completed challenges instead of 14%).

Root cause: 446 block names are shared across multiple superblocks (e.g. workshop-greeting-bot exists in both javascript-v9 and introduction-to-variables-and-strings-in-javascript). The allChallengeNode GraphQL query returns nodes for all superblocks, so getCurrentBlockIds was collecting challenge IDs from all superblocks that share the same block name. This doubled currentBlockIds.length for shared blocks:

  • A 7-challenge block appeared to have 14 IDs → 1/14 = 7% (instead of 1/7 = 14%)
  • Completing all 7 visible challenges → 7/14 = 50%

Fix

  1. client/src/templates/Challenges/utils/fetch-all-curriculum-data.tsx — Added certification to the allChallengeNode GraphQL query so it's available for filtering.

  2. client/src/utils/get-completion-percentage.ts — Added certification to the challengeNodes filter in getCurrentBlockIds, ensuring only challenges belonging to the current superblock are counted.

  3. client/src/utils/get-completion-percentage.test.ts — Added a regression test covering the shared-block scenario.

@ragini-pandey ragini-pandey requested review from a team as code owners April 21, 2026 19:08
@github-actions github-actions Bot added platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. deprioritized PR reviews are deprioritized; lacks productive input and ignores codebase best practices. labels Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hi there,

Thanks for opening this pull request.

The automated checks found some issues:

Linked Issue: The linked issue has not been triaged yet, and a solution has not been agreed upon. Once the issue is open for contribution, you are welcome to update this pull request to reflect the issue consensus. Until then, we will not be able to review your pull request.


Join us in our chat room or our forum if you have any questions or need help with contributing.

@Jeevankumar-s Jeevankumar-s added the status: blocked In a transient & temporary hold. label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprioritized PR reviews are deprioritized; lacks productive input and ignores codebase best practices. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. status: blocked In a transient & temporary hold.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Progress bar after completing a challenge only fills to up to 50%

2 participants