Skip to content

fix(learn): fix workshop progress bar calculation and deduplicate cha… - #1826

Open
rohanesor wants to merge 1 commit into
freeCodeCamp:mainfrom
rohanesor:fix/workshop-progress-bar
Open

fix(learn): fix workshop progress bar calculation and deduplicate cha…#1826
rohanesor wants to merge 1 commit into
freeCodeCamp:mainfrom
rohanesor:fix/workshop-progress-bar

Conversation

@rohanesor

Copy link
Copy Markdown

Fixes #1785

Description

Fixes an issue where workshops and labs (e.g. in JS and Python certs) display incorrect progress (adding 10% per step instead of 20%) and only reach 50% completion when all steps are finished.

Motivation & Context

Block.fromJson parsed data['challengeOrder'] without deduplicating challenge IDs. When duplicate challenge entries existed in block metadata, block.challenges.length became double the actual step count (e.g. 10 instead of 5), while user progress only records 1 completion per unique challenge ID (e.g. 5). Thus 5 / 10 = 50%.

Changes Made

  • mobile-app/lib/models/learn/curriculum_model.dart: Deduplicated challengeOrder by id in Block.fromJson to ensure challenges and challengeTiles contain accurate unique step counts.
  • mobile-app/lib/ui/views/learn/widgets/pass/pass_widget_view.dart: Added .clamp(0.0, 1.0) and .clamp(0, 100) bounds safety to progress indicators.

Checklist

  • Verified progress calculation logic.
  • Follows existing project architecture and conventions.
  • Clean minimal changes across 2 files.
image

@rohanesor
rohanesor requested a review from a team as a code owner August 7, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When doing a workshop, the progress bar along the bottom treats the 50% mark as the 100%

1 participant