Skip to content

fix: show progress for small goal completion - #3507

Open
PhanisrideepthiThota wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
PhanisrideepthiThota:fix-goaltracker-progress
Open

PhanisrideepthiThota wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
PhanisrideepthiThota:fix-goaltracker-progress

Conversation

@PhanisrideepthiThota

Copy link
Copy Markdown
Contributor

Summary

Fixed the GoalTracker progress calculation so goals with non-zero progress do not incorrectly display 0%.

Closes #1895


Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

What Changed

  • Updated the progress percentage calculation in src/components/GoalTracker.tsx.
  • Ensured any goal with non-zero progress displays at least 1%.
  • Goals with zero progress continue to display 0%.
  • Kept the progress capped at 100%.

How to Test

  1. Run the application locally.
  2. Open the GoalTracker on the dashboard.
  3. Create or use a goal with a very small non-zero progress value.
  4. Verify that the progress displays at least 1% instead of 0%.

Expected result:

Goals with actual > 0 should display at least 1% progress, while goals with actual === 0 should display 0%.


Screenshots / Recordings


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

Accessibility (UI changes only)

  • Keyboard navigation works correctly
  • Color contrast meets WCAG AA standard
  • ARIA labels / roles added where needed
  • Tested on mobile / responsive layout

Additional Context

The fix follows the acceptance criteria in issue #1895: 0% should only be shown when there is no progress.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) labels Aug 31, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@deepsource-io

deepsource-io Bot commented Aug 31, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 6e22da7...a160e15 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Secrets Aug 31, 2026 7:56p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@PhanisrideepthiThota

Copy link
Copy Markdown
Contributor Author

After merging upstream/main into my branch as requested, the latest CI run is failing in existing GoalTracker tests.

The Type Check reports that test/GoalTracker.test.ts imports useGoalTracker, but the current src/components/GoalTracker.tsx from upstream no longer exports that hook.

The E2E check also fails because the existing GoalTracker E2E test expects a Create goal button that is not present in the current upstream component.

My actual change is limited to the progress percentage calculation for non-zero progress. Could you please confirm whether these are known upstream/main CI issues or whether you want me to address them as part of this PR?

@PhanisrideepthiThota

Copy link
Copy Markdown
Contributor Author

I investigated the current Type Check failure. test/GoalTracker.test.ts imports useGoalTracker from @/components/GoalTracker, but the current src/components/GoalTracker.tsx only exports the default GoalTracker component and no longer exports useGoalTracker.

This mismatch is present in the current upstream code as well, so I have not modified the test/component because it is unrelated to issue #1895. The progress calculation fix itself is preserved in this PR.

@PhanisrideepthiThota

PhanisrideepthiThota commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder,The fix for #1895 is complete. I also identified the cause of the Type Check failure, but it originates from an existing upstream mismatch unrelated to this change. There’s nothing more to alter on my side unless you want otherwise.

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

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] GoalTracker shows 0% progress for goals with fractional completion < 0.5%

1 participant