Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaderboard Only Shows Top 50 – Users Should See Their Own Rank #3715

Open
ismailkonvah opened this issue Feb 7, 2025 · 1 comment
Open

Comments

@ismailkonvah
Copy link

Problem Statement
Currently, the leaderboard on dashboard.union.build only displays the top 50 users based on their scores. However, users who are not in the top 50 have no way of knowing their rank.

Expected Behavior
The leaderboard should continue displaying only the top 50 users as intended.
Users outside the top 50 should still be able to see their exact rank and score somewhere on the dashboard.

Proposed Fix
Modify the leaderboard query to:
Fetch the top 50 users as usual.
Additionally, fetch the current logged-in user's rank and score even if they are not in the top 50.
Display the user’s position at the bottom of the leaderboard or in a separate section.

Technical Implementation Suggestions
Database Query Update:
Use SQL RANK() or ROW_NUMBER() to get the user’s position.
Fetch the top 50 + current user's rank.
Example SQL Query: SELECT name, score, RANK() OVER (ORDER BY score DESC) as rank
FROM players
WHERE rank <= 50 OR name = 'current_user';

Frontend Update:
Show the user's rank and score below the leaderboard or in a "Your Rank" section.

Tasks
Update the database query to always return the logged-in user's rank.
Modify the frontend to display the user’s rank if they are outside the top 50.
Test with various users (inside and outside the top 50).
Deploy and verify changes.

Integration Context
This update applies to the leaderboard on dashboard.union.build.

@ismailkonvah
Copy link
Author

@cor

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

No branches or pull requests

1 participant