Part of #17. Blocked by: #22, #19 (needs Race results to rank, and Friends for the Friends-scoped view).
Scope
Queries + handler for a Race Type's Leaderboard:
- Ranked by each racer's own personal-best result only (not every attempt).
- Filtered by time window: All-Time / Month / Week — each its own ranking, not combined.
- Filtered by scope: Global, or Friends-only (a filter over the same underlying data, not a separate structure).
- DNF results excluded.
Geography-based ("in your area") scope is explicitly out of scope — deferred, undesigned.
Includes adding the db/queries/*.sql this service needs and running make sqlc-generate — the schema issue (#18) only creates migrations, it doesn't pre-write queries. Follow the existing db/queries/users.sql pattern: queries scoped to what this service actually asks the DB, not generic per-table CRUD.
Testing
- Integration tests (
-tags integration) covering personal-best selection, each time window boundary, and Friends-scope filtering.
- Handler: unit tests with narrow interfaces +
httptest.
See CONTEXT.md (Leaderboard).
Part of #17. Blocked by: #22, #19 (needs Race results to rank, and Friends for the Friends-scoped view).
Scope
Queries + handler for a Race Type's Leaderboard:
Geography-based ("in your area") scope is explicitly out of scope — deferred, undesigned.
Includes adding the
db/queries/*.sqlthis service needs and runningmake sqlc-generate— the schema issue (#18) only creates migrations, it doesn't pre-write queries. Follow the existingdb/queries/users.sqlpattern: queries scoped to what this service actually asks the DB, not generic per-table CRUD.Testing
-tags integration) covering personal-best selection, each time window boundary, and Friends-scope filtering.httptest.See
CONTEXT.md(Leaderboard).