Skip to content

feat: Stable Ranking and Deterministic Sorting for Leaderboard (#2, #8)#100

Open
TodouWisiper wants to merge 1 commit into
gbabaisaac:mainfrom
TodouWisiper:fix-bounty-2
Open

feat: Stable Ranking and Deterministic Sorting for Leaderboard (#2, #8)#100
TodouWisiper wants to merge 1 commit into
gbabaisaac:mainfrom
TodouWisiper:fix-bounty-2

Conversation

@TodouWisiper

Copy link
Copy Markdown

🏆 Stable Ranking & Deterministic Sorting Implementation

This PR addresses issue #2 and #8 by fixing the unstable sorting logic and implementing proper competition ranking.

✨ Key Improvements:

  1. Deterministic Sorting: Added secondary and tertiary sort keys.
    • 1st: Total Earned (Descending)
    • 2nd: Bounties Completed (Descending)
    • 3rd: Name (Alphabetical)
      This ensures users don't jump around on every refresh when earnings are tied.
  2. Standard Competition Ranking (1-2-2-4): Users with the same earnings now correctly receive the same rank, following the standard competition model.
  3. Enhanced UI:
    • Added Medal Emojis (🥇, 🥈, 🥉) for the top 3 earners.
    • Improved card styling with better hover states, borders, and rounded corners.
    • Added a clear "Total Earned" label for better data visualization.
  4. Performance: Wrapped logic in useMemo to prevent unnecessary recalculations on re-renders.

🧪 Verification:

  • Tied users Alice and Bob (both $35.00) now correctly share Rank 2.
  • Tied users Diana, Eve, and Frank (all $20.00) now correctly share Rank 4.
  • Sorting remains consistent across all renders.

/claim #2
/claim #8

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.

1 participant