Skip to content

Leaderboards: personal-best, time window, Friends scope #25

Description

@trriplejay

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentSpec is ready for an agent to implement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions