feat(profile): derive the profile P&L from the real round ledger#53
Merged
Conversation
ProfileViewModel now combines the signed-in identity with GameRepository.rounds, replacing the placeholder P&L and game-activity blocks with values computed from the persisted game_round ledger. The all-time summary (net, bets, win rate, won/wagered) and the per-game activity breakdown (bets, wagered and net per game, ordered by volume) come from the real rounds; with no rounds the screen shows zeros and a "No game activity yet" empty state. This closes the stats layer: history, round detail and the profile now all read real rounds. Covered by the extended ProfileViewModelTest.
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 2 (final) of the stats layer: the profile's P&L and game-activity blocks now read the persisted
game_roundledger instead of placeholder numbers. With history and round detail already wired, this closes the stats layer - the three round-consuming screens all show real data.Rationale
ProfileViewModelcombinesAuthRepository.currentUser(the real identity, already wired) withGameRepository.rounds(the real rounds). The identity, Error and sign-out behaviour are unchanged; only the P&L and game-activity blocks move from placeholders to computed values:Kept scoped to the ViewModel + the activity empty state; the screen composables and the data shapes (
ProfilePnl,GameActivityRow) are unchanged.Verification
./gradlew testDebugUnitTest detekt ktlintCheck assembleDebug compileDebugAndroidTestKotlingreen locally (JDK 17).ProfileViewModelTestextended: identity/error/sign-out cases preserved, plus new cases asserting the P&L and game-activity derivation from rounds.Test plan
Related issues
Refs the stats-layer work for the final entrega (phase 2 of 2; closes the stats layer).
Checklist
feat/,fix/,chore/, etc.).[Unreleased].