Repository navigation
feat: copy each deck's win summary onto its deck doc - #587
Open
TytaniumDev wants to merge 1 commit into
Open
TytaniumDev wants to merge 1 commit into
TytaniumDev wants to merge 1 commit into
Conversation
Aggregation's ratings transaction now writes summary { gamesPlayed, wins,
winRate } onto each rated deck's doc, so GET /api/decks lists win stats
without reading stats docs. Local mode joins the ratings rows in at read
time. A data wipe clears the summaries with the ratings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FUGyg98DxHVdFazZLDFw7b
TytaniumDev
enabled auto-merge (squash)
October 30, 2026 06:51
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Tyler · project thread
Summary
Tyler chose "flag plus a rating summary" for deck docs, so a future page can list decks with their stats without reading every
stats/ratingdoc.RatingStore.applyJob(Firestore) writessummary: { gamesPlayed, wins, winRate }onto each rated deck'sdecks/{id}doc in the same transaction that updates its rating.update, notset, so a deck deleted since its job ran is not recreated.winRateis stored rather than derived so decks can be sorted by it.GET /api/decksandgetDeckByIdreturnsummary(null until the deck has rated games). Local mode joins the SQLiteratingsrows in at read time (listDeckSummaries).deckSummariesleftover kind clears the summaries on precon docs after ratings are wiped. In SQLite it's a no-op.Test plan
test/deck-summary.test.ts(added totest:unit) passes on both SQLite and the Firestore emulator: an unrated deck has no summary, a rated deck lists its games, wins and win rate, and wiping ratings clears the summaries.rating-store,data-wipeanddeck-selection-storetests pass on the emulator.npm run lint --prefix api,npm run test:unit --prefix api, frontendtsc -b.Generated by Claude Code