feat(vote): add /vote-leaderboard and /vote-results - #62
Merged
Conversation
Two super admin pages over the alumni Borda vote, wiring up the last two backend endpoints the front end never called: - /vote-leaderboard reads GET /alumni/leaderboard and renders the tally through the shared leaderboard board, mapping borda_score onto the score the row already displays. - /vote-results reads GET /alumni/votes and lists each alumni's ballot in rank order — the breakdown the tally is computed from. Both gate on super_admin alone, mirroring get_current_super_admin: the alumni who cast the votes don't see either page, the same way a super admin is turned away from the ballot itself. Both join the super admin's nav so they're reachable, and both stand in a Notice when there is nothing to show. Named in PROTECTED_PREFIXES and the proxy matcher explicitly — the prefix match is exact-or-slash, so the existing /vote entry does not cover them.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…out, larger text, better description
…-based nav, theme-aware logo, avatar dropdown and alumni support
…page styling and remove em-dashes
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.
Summary
Two
super_adminpages over the alumni Borda vote, wiring up the last two backend endpoints the front end never called./vote-leaderboard—GET /alumni/leaderboard, the tallied Borda board. Rendered through the sharedLeaderboardComponent, mappingborda_scoreonto thetotal_scorethe row already displays rather than teaching the row a second field./vote-results—GET /alumni/votes, every alumni's ballot in rank order. This is the audit trail the tally is computed from, so the ranking goes in as an<ol>— the numbers are the data, not decoration.Both gate on
super_adminalone, mirroringget_current_super_admin: the alumni who cast the votes don't see either page, the same way asuper_adminis turned away from the ballot itself. Both join the super admin's nav so they're reachable, and both stand in aNoticewhen there's nothing to show.Both routes are named explicitly in
PROTECTED_PREFIXESand the proxy matcher. Worth a reviewer's eye: the prefix match is exact-or-slash, so the existing/voteentry does not cover/vote-leaderboard— without those lines they'd be publicly routable, and while the page guard would still deny, there'd be no login redirect.Notes for review
/vote-leaderboardcomputes nothing — it renders the backend'sORDER BY borda_score DESCorder as-is, with the rank number being the array position. That differs from/leaderboardand/super-admin-leaderboard, which each re-sort in the frontend on top of an endpoint that already sorts. Happy to add the same sort for consistency; it would also stabilise ties, which the backend query leaves unbroken.Linked issue
Checklist
pnpm lintpassespnpm buildpassesAlso run:
pnpm typecheckandpnpm test(74 passed). Not yet looked at in a browser — no component/browser test setup here, and the local database has no cast ballots, so both pages currently render their empty-state notice.