Expand /leaderboards/stats overview — players, picks, winning archetypes#265
Open
ptrlrd wants to merge 1 commit into
Open
Expand /leaderboards/stats overview — players, picks, winning archetypes#265ptrlrd wants to merge 1 commit into
ptrlrd wants to merge 1 commit into
Conversation
Roadmap #4 (post-Codex-Score). Three additions to the Overview tab: 1. Two new tiles in the totals strip: - Named players (DISTINCT username, excluding anonymous submissions) - Cards picked (SUM was_picked across run_card_choices) 2. New "Top winning cards by character" panel — five mini-decks below the ascension breakdown, one per character (Ironclad/Silent/Defect/ Necrobinder/Regent), showing the five most-frequent cards in winning runs. Always unfiltered: the per-character grid collapses to a tautology if the user narrows to one character, so the panel is hidden when stats.filters.character is set. 3. Strip expanded from 4 to 6 tiles (Runs / Wins / Losses / Win % / Players / Picks). Numbers now use .toLocaleString() for thousands separators which become readable past 10k runs. ### Backend get_stats() returns three new fields: unique_players — distinct non-NULL usernames total_cards_picked — SUM(was_picked) from run_card_choices winning_cards_by_character — { CHAR: [{card_id, count}, ...] } The winning-cards-per-character query uses SQLite's window function: ROW_NUMBER() OVER (PARTITION BY character ORDER BY COUNT(*) DESC) to pick the top 5 per character in a single query rather than 5 follow-up queries. SQLite 3.25+; the prod container is well past that. Computed on-demand alongside the rest of get_stats — same query budget. The aggregate ignores all WHERE filters intentionally; the panel is a community-meta overview and the rest of the response already gives the filtered slice. ### Frontend StatsClient interface gains unique_players, total_cards_picked, and optional winning_cards_by_character. OverviewTab threads `lp` (language prefix) through props so the new card links route through the i18n landing pages correctly.
e0c652f to
04bf8f7
Compare
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.
Re-created after the 2026-05-14 12:42 UTC repo rollback closed the original #250.
Roadmap #4. Adds 2 totals tiles (Named players via COUNT(DISTINCT username), Cards picked via SUM(was_picked)) plus a new 'Top winning cards by character' panel (5 mini-decks, one per character, top 5 winning-deck cards each, via SQLite window function ROW_NUMBER OVER PARTITION BY character). get_stats() now returns unique_players, total_cards_picked, winning_cards_by_character. No schema change.