mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-19 17:58:24 -05:00
TournamentBadgeOwner previously stored manual grants as N identical rows to represent "this user has this badge N times" — one user had 12,345 duplicate rows for a single badge. This adds a `count` column, collapses NULL-tournamentId duplicates in the backfill, and rewrites the BadgeOwner view to expose count via SUM. The table shrinks from 75,596 to 24,204 rows. Also adds an index on TournamentBadgeOwner(userId) as defense-in-depth for direct lookups, and updates replaceOwners to dedupe ownerIds at insert time. Profile-page query for the worst-case user drops from ~4 ms to ~1–2 ms warm. |
||
|---|---|---|
| .. | ||
| actions | ||
| components | ||
| loaders | ||
| routes | ||
| BadgeRepository.server.test.ts | ||
| BadgeRepository.server.ts | ||
| badges-constants.ts | ||
| badges-schemas.server.ts | ||
| badges-utils.ts | ||
| badges.module.css | ||
| homemade.json | ||