feat(stats): wire history and round detail to the real round ledger#52
Merged
Conversation
Connect the persisted game_round ledger (added with Coinflip) into the two screens that were still on preview data. HistoryViewModel maps GameRepository.rounds into the list rows plus the aggregate summary (rounds, win rate, net); search and filtering stay screen-local, and a dedicated "no rounds yet" empty state distinguishes an empty ledger from a filtered-out one. RoundDetailViewModel resolves a round by the nav-arg id via GameRepository.getRound and exposes Loading / Success / NotFound; the RoundDetailScreen is now stateless over that state. The provably-fair block renders the round's real serverSeed / clientSeed / nonce / HMAC hash, so the outcome is independently verifiable. Adds GameRepository.getRound. Also fixes CoinflipScreenTest, which still referenced the pre-stateless CoinflipScreen signature (the assemble/unit CI job does not compile the instrumented sources, so it went unnoticed). Covered by HistoryViewModelTest, RoundDetailViewModelTest and the new getRound cases in GameRepositoryImplTest.
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.
Summary
Phase 1 of the stats layer: connects the persisted
game_roundledger (added with Coinflip) into the two screens that were still rendering preview data. History (CU-10) now lists the rounds actually played with a live aggregate summary, and Round Detail (CU-11) resolves a round by id and shows its real, verifiable provably-fair seeds.Rationale
The round ledger existed but had no readers. Wiring History + Round Detail first delivers the marquee defense feature (real provably-fair verification) and is self-contained:
HistoryViewModelmapsGameRepository.roundsinto the existingHistoryData(rows + summary: rounds, win rate, net). Search/filter stay screen-local. A "no rounds yet" empty state is distinguished from the filtered-out "no rounds match".RoundDetailViewModelreads the nav-arg id, resolves the round via the newGameRepository.getRound, and exposesLoading / Success / NotFound;RoundDetailScreenis now stateless over that state (matching the Wallet/News pattern). The provably-fair block carries the round's real serverSeed / clientSeed / nonce / HMAC hash.RoundDetailDatamapping is coinflip-shaped for now (no crash bar) and branches onGameRound.game, so the other games slot in as they land.Profile P&L is intentionally left on preview data; it is the next slice (kept out to keep this PR scoped and avoid destabilizing the Profile tests).
Also fixes
CoinflipScreenTest, which still called the pre-statelessCoinflipScreensignature from the Coinflip PR. The "assemble and unit tests" CI job does not compile the instrumented sources, so it was not caught; this PR compiles them locally.Verification
./gradlew testDebugUnitTest detekt ktlintCheck assembleDebug compileDebugAndroidTestKotlingreen locally (JDK 17).HistoryViewModelTest,RoundDetailViewModelTest,getRoundcases inGameRepositoryImplTest.Test plan
Related issues
Refs the stats-layer work for the final entrega (phase 1 of 2; profile P&L is phase 2).
Checklist
feat/,fix/,chore/, etc.).[Unreleased].