Skip to content

fix(leaderboard): make rank column reflect active sort column and dir…#1170

Open
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:fix/leaderboard-rank-sort-aware
Open

fix(leaderboard): make rank column reflect active sort column and dir…#1170
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:fix/leaderboard-rank-sort-aware

Conversation

@Khaostica
Copy link
Copy Markdown

Summary

In the list view of the leaderboards (/top-miners, /discoveries, /watchlist), the Rank column was just "row number in the current sort" — re-numbered starting at 1 from the top regardless of direction. Two visible symptoms came out of that:

  1. The gold/silver/bronze "1/2/3" badges landed on the worst miners in any ascending sort. Sort Credibility ascending (ASC) and the miner with the lowest credibility shows up at the top of the list with the gold "# 1" badge. Same for Score ASC, Earnings ASC, etc.

  2. ASC and descending (DESC) of the same column didn't mirror each other. Because rank was always re-numbered from the top, flipping direction reshuffled the rank values across miners instead of just turning the list upside-down. The same miner could be rank "1" in ASC and rank "N" in DESC, even though their actual standing hadn't moved.

Fix

rankedMiners in TopMinersTable.tsx now derives rank from the active column in its descending (canonical) direction, then reverses the list for ASC. Rank "1" / the gold badge consistently means "best by the column you're viewing," and ASC of any column is N, N-1, … 1 top-to-bottom — so the last-place miner shows up at the top with their actual last-place rank. Filters still apply downstream and never renumber.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Screenshots

Before:
Before - Credibility
Before - Earnings

After:
After - Credibility
After - Earnings

Additional Video

Trimmed.Leaderboard.Fix.Demo.mp4

Checklist

  • New components are modularized/separated where sensible
  • Uses predefined theme (e.g. no hardcoded colors)
  • Responsive/mobile checked
  • Tested against the test API
  • npm run format and npm run lint:fix have been run
  • npm run build passes
  • Screenshots included for any UI/visual changes

…ection

Previously the rank column showed a stable position in totalScore desc no
matter which column was being sorted by, and ASC sorts left ranks anchored
to the input order via sort stability — so the gold/silver/bronze podium
glow on rank 1 could land on miners that weren't first in the visible
list, and clicking ASC on any column produced a rank column that didn't
mirror DESC.

Recompute rank from the active sort metric (descending = canonical), then
reverse for ASC. Filters still apply downstream, leaving the surviving
rows with their original (column-specific) rank values.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant