Skip to content

Conversation

@Armaansaxena
Copy link

Description

This PR fixes Issue #3278 where the profile completion percentage would fluctuate (e.g., 40% -> 100% -> 40%) on page refresh.

The Cause:
The previous logic iterated over all properties returned by the user API (for var i in result). Since the backend response structure can vary (including/excluding metadata fields or changing order), the total field count count was inconsistent. This caused the percentage calculation (countLeft / count) * 100 to produce random results on refresh.

The Fix:
Updated profileCtrl.js to calculate completion based on a predefined list of relevant profile fields (first_name, last_name, affiliation, etc.) instead of iterating over the entire response object. This ensures the denominator is always constant.

Related Issue

Fixes #3278

How Has This Been Tested?

  1. Started the application locally using docker-compose.
  2. Logged in as a superuser.
  3. Navigated to the Profile page.
  4. Refreshed the page 10+ times.
  5. Verified that the "Profile Completed" percentage remains stable and accurate.

@Armaansaxena Armaansaxena force-pushed the fix-3278-profile-percentage branch from e1b0518 to 4306083 Compare December 4, 2025 17:04
Update the profile completion logic to calculate percentage based on a
fixed list of fields rather than iterating over all API response keys.
This prevents the percentage from fluctuating when the backend returns
inconsistent metadata fields.

Fixes Cloud-CV#3278
@Armaansaxena Armaansaxena force-pushed the fix-3278-profile-percentage branch from 4306083 to 6032240 Compare December 4, 2025 17:09
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.

Profile completed percentage changing on refreshing

1 participant