fix: use dense ranking on profile pages to match ranking table#17
Merged
Merged
Conversation
The profile page was reading pre-computed rank values from the JSON data which used competition ranking (skips numbers after ties). The ranking table on the overview page computes dense ranks client-side (rank only increments by 1 per distinct score). This fix adds client-side dense rank computation for: - Author profile rank card - Institution profile rank card - Author ranking history chart - Institution ranking history chart Example: Anjo Vahldiek-Oberwagner was shown as rank 11 but should be 9 (two tied pairs above reduce the dense rank by 2).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The profile page displayed ranks using competition ranking (from the pre-computed
rankfield in JSON data), while the ranking table computed dense ranks client-side. This caused mismatches — e.g., Sanidhya Kashyap showed rank 4 in the header but the ranking table showed the correct dense rank.Additionally, the ranking history chart showed stale values from old snapshots that used competition ranking.
Fix
assignDenseRanks()to compute dense ranks client-side fromcombined_scorefixHistoryRanks()to recompute dense ranks within each history snapshot from stored scores_denseRankinstead of the storedrankfieldVerification
Tested that Anjo Vahldiek-Oberwagner shows rank 9 (not 11) and Sanidhya Kashyap shows rank 4 (not higher), matching the ranking table.