Fix profile completion percentage fluctuation
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?
- Started the application locally using
docker-compose. - Logged in as a superuser.
- Navigated to the Profile page.
- Refreshed the page 10+ times.
- Verified that the "Profile Completed" percentage remains stable and accurate.