Skip to content

fix: replace hardcoded progress cap with derived PROGRESS_MAX_POINTS#807

Open
nancysangani wants to merge 1 commit into
komalharshita:mainfrom
nancysangani:fix/progress-calculation-math-error
Open

fix: replace hardcoded progress cap with derived PROGRESS_MAX_POINTS#807
nancysangani wants to merge 1 commit into
komalharshita:mainfrom
nancysangani:fix/progress-calculation-math-error

Conversation

@nancysangani

Copy link
Copy Markdown

Fixes #738

computeProgressPoints used a hardcoded divisor of 250 that was lower than what a normal user accumulates, producing percentages above 100% before the Math.min clamp. The clamp fixed the display but left aria-valuenow set to values like 150, violating the ARIA progressbar spec.

Changes:

  • static/script.js — extracted per-action point values and activity targets as named constants; PROGRESS_MAX_POINTS (450) is derived from those constants; computeProgressPoints clamps progress.points at max; percentage formula uses PROGRESS_MAX_POINTS as divisor
  • tests/test_progress_calculation.py — 28 tests: arithmetic correctness, original bug scenario regression, clamp behaviour, ARIA attribute validation, accessibility range checks

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

@nancysangani is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@nancysangani

Copy link
Copy Markdown
Author

Hi @komalharshita, please review the PR when you get a chance. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Learning Progress Not Calculated Correctly - Math Error

1 participant