Skip to content

feat(vote): add /vote-leaderboard and /vote-results - #62

Merged
Adel2411 merged 4 commits into
devfrom
feat/vote-results-and-leaderboard
Jul 30, 2026
Merged

feat(vote): add /vote-leaderboard and /vote-results#62
Adel2411 merged 4 commits into
devfrom
feat/vote-results-and-leaderboard

Conversation

@0xHouss

@0xHouss 0xHouss commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two super_admin pages over the alumni Borda vote, wiring up the last two backend endpoints the front end never called.

  • /vote-leaderboardGET /alumni/leaderboard, the tallied Borda board. Rendered through the shared LeaderboardComponent, mapping borda_score onto the total_score the row already displays rather than teaching the row a second field.
  • /vote-resultsGET /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_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's nothing to show.

Both routes are named explicitly in PROTECTED_PREFIXES and the proxy matcher. Worth a reviewer's eye: the prefix match is exact-or-slash, so the existing /vote entry 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-leaderboard computes nothing — it renders the backend's ORDER BY borda_score DESC order as-is, with the rank number being the array position. That differs from /leaderboard and /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 lint passes
  • pnpm build passes

Also run: pnpm typecheck and pnpm 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.

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.
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
brandiha Ready Ready Preview Jul 30, 2026 11:55pm

…-based nav, theme-aware logo, avatar dropdown and alumni support
@Adel2411
Adel2411 merged commit 847fcbc into dev Jul 30, 2026
3 checks passed
@Adel2411
Adel2411 deleted the feat/vote-results-and-leaderboard branch July 30, 2026 23:55
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.

2 participants