You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: