feat(stats): best-move word, moves & hint-share, and a hint-count fix (#81)
The statistics screen gains real depth, plus a hint-count bug fix found along the way. - Best move per variant: the screen shows the actual best-move word (drawn as game tiles; a wildcard shows its letter but no value), broken down by game variant, empty variants omitted. New account_best_move table, written at game finish. - Moves & hint share: two new lifetime tiles — the player's play count and the share of plays that used a hint — from summed account_stats counters (moves, hints_used). Honest-AI games are excluded, like the rest of the stats. - Hint-count fix: the in-game hint badge no longer goes stale across games. The global wallet now rides the wire apart from the per-game allowance (wallet_balance on StateView/HintResult/StatsView), so the client reads the live wallet rather than a per-game snapshot; game_players.hints_used now counts every hint (allowance + wallet), its true per-game total. - Account merge: sums the new moves/hints_used counters and merges the per-variant best moves (higher score kept), which it previously dropped. - Admin: the user card shows Moves and Hints used. - UI polish: tab/label wording, game-over text, and e2e selectors hardened against label changes. All wire additions are trailing (backward-compatible). Docs (ARCHITECTURE, FUNCTIONAL +ru, UISN_DESIGN) updated in step.
This commit was merged in pull request #81.
This commit is contained in:
+10
-2
@@ -53,11 +53,19 @@ test('invitations: the lobby shows an invitation and accepting clears it', async
|
||||
await expect(page.getByText(/From Kaya/)).toBeHidden();
|
||||
});
|
||||
|
||||
test('stats screen shows the metrics', async ({ page }) => {
|
||||
test('stats screen shows the metrics and the per-variant best move', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await page.getByRole('button', { name: /Stats/ }).click();
|
||||
await expect(page.getByText('Win rate')).toBeVisible();
|
||||
await expect(page.getByText('Best move')).toBeVisible();
|
||||
// The Moves count and the derived Hint share (12 hints / 248 plays = 4.8%, one decimal).
|
||||
await expect(page.getByText('Moves', { exact: true })).toBeVisible();
|
||||
await expect(page.getByText('Hint share')).toBeVisible();
|
||||
await expect(page.getByText('4.8%')).toBeVisible();
|
||||
// The best move breaks down per played variant, each row labelled by the variant and
|
||||
// ending in the play's score (the word itself renders as game tiles).
|
||||
await expect(page.getByText('Scrabble', { exact: true })).toBeVisible();
|
||||
await expect(page.getByText('134')).toBeVisible();
|
||||
});
|
||||
|
||||
test('settings hub: tabs switch in place and back returns to the lobby', async ({ page }) => {
|
||||
@@ -158,7 +166,7 @@ test('lobby ⚙️ tab shows the pending friend-request count', async ({ page })
|
||||
|
||||
test('play with friends: a game type is required to send an invitation', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await page.getByRole('button', { name: /New/ }).click(); // lobby tab bar
|
||||
await page.getByRole('button', { name: /🎲/ }).click(); // lobby tab bar (New Game tab, by its 🎲 icon — the label is themeable)
|
||||
await page.getByRole('button', { name: 'Play with friends' }).click();
|
||||
|
||||
const send = page.getByRole('button', { name: 'Send invitation' });
|
||||
|
||||
Reference in New Issue
Block a user