Skip to content

fix(seed): make the demo dataset usable out of the box#46

Merged
aykhan019 merged 1 commit into
aykhan019:mainfrom
endorphin13:fix/seed-demo-dataset
May 31, 2026
Merged

fix(seed): make the demo dataset usable out of the box#46
aykhan019 merged 1 commit into
aykhan019:mainfrom
endorphin13:fix/seed-demo-dataset

Conversation

@endorphin13

Copy link
Copy Markdown
Contributor

Why

On a fresh local database, the documented db:seed left several screens empty, which is exactly what a grader running the project locally would hit.

What changed

  • Trending was always empty. Seeded plays were anchored to a fixed past date (2026-05-23), so the Trending query's "last 7 days" window matched nothing on any later date. run.ts now anchors seeded play timestamps to the run date. Catalog generation stays deterministic (the PRNG seed is unchanged); only the play/playlist dates move.
  • Only 3 of 5 users had history. historyUsers was 3, so sam/riley had no plays and showed empty analytics. Raised to 5 and bumped historyPerUser 60–110 → 90–160 so every seeded account has a fuller dashboard.
  • Setup never seeded. scripts/setup.sh ran install + migrate + build but only printed a seed hint, so pnpm setup && pnpm dev produced an empty UI. It now runs db:seed (skip with SKIP_SEED=1) and prints the demo login.
  • README now includes the seed step in the local-dev happy path and documents the demo account.

Verification

pnpm --filter @statify/db typecheck and pnpm --filter @statify/db test pass (72 tests, incl. the seed determinism + history-window tests).

The README's db:seed produced data that left key screens empty on a fresh
local database:

- Trending returned zero rows: seeded plays were anchored to a fixed past
  date (2026-05-23), so the "last 7 days" window was empty on any later date.
  Anchor seeded play timestamps to the run date instead (run.ts); catalog
  generation stays deterministic since the PRNG seed is unchanged.
- Only 3 of 5 seeded users had history, so logging in as sam/riley showed
  empty analytics. Seed history for all five users and make each fuller
  (historyUsers 3 -> 5, historyPerUser 60-110 -> 90-160).
- setup.sh migrated but never seeded, so `pnpm setup && pnpm dev` left an
  empty UI. Run db:seed during setup (skip with SKIP_SEED=1) and print the
  demo login.
- README: add the seed step to the local-dev happy path and document the
  demo account (alex@statify.local / statify123).
@endorphin13 endorphin13 requested a review from aykhan019 as a code owner May 31, 2026 18:00
@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

@fateh-mammadli is attempting to deploy a commit to the Aykhan's projects Team on Vercel.

A member of the Team first needs to authorize it.

@aykhan019 aykhan019 merged commit 284f667 into aykhan019:main May 31, 2026
1 of 2 checks passed
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.

3 participants