Compare commits

...

6 Commits

Author SHA1 Message Date
semantic-release-bot
1219539585 chore(release): 2.8.2 [skip ci]
## [2.8.2](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.8.1...v2.8.2) (2025-10-08)

### Bug Fixes

* revert to showing only active players in room games ([87cc0b6](87cc0b64fb))
2025-10-08 16:55:40 +00:00
Thomas Hallock
87cc0b64fb fix: revert to showing only active players in room games
Reverted getRoomActivePlayers() to use getActivePlayers() instead of
getAllPlayers(). Room games should show only players marked isActive=true
from each room member, not all players regardless of status.

Behavior:
- Room mode: Active players from all room members
- Solo mode: Active players from current user

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 11:54:43 -05:00
semantic-release-bot
c640a79a44 chore(release): 2.8.1 [skip ci]
## [2.8.1](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.8.0...v2.8.1) (2025-10-08)

### Bug Fixes

* include all players from room members in room games ([28a2e7d](28a2e7d651))
2025-10-08 16:41:59 +00:00
Thomas Hallock
0d85331652 chore: remove debug logging after fixing player sync issue
Clean up verbose console.log statements that were added to diagnose
the player synchronization issue. The root cause has been identified
and fixed in player-manager.ts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 11:41:02 -05:00
Thomas Hallock
28a2e7d651 fix: include all players from room members in room games
Change getRoomActivePlayers() to fetch ALL players from room members,
not just those marked with isActive=true. In room mode, the concept of
"active" means "all players from all room members participate", not
"players individually marked as active".

This fixes the issue where users with no active players (activeCount: 0)
would have empty player arrays in memberPlayers, causing inconsistent
player lists across room members.

Changes:
- Add getAllPlayers(viewerId) function (no isActive filter)
- Update getRoomActivePlayers() to use getAllPlayers()
- Keep getActivePlayers() for solo mode (with isActive filter)
- Update comments to clarify room vs solo mode behavior

Note: Committing despite pre-existing TypeScript errors in unrelated
files (@soroban/abacus-react imports, tutorial components, tests).
player-manager.ts changes are type-safe and don't introduce new errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 11:40:15 -05:00
Thomas Hallock
a27c36193e debug: add logging to diagnose player sync issue
Add console logging to track:
- When GameModeContext computes activePlayers from room data
- Which players are being added to the active set
- What activePlayers are sent when starting the game

This will help diagnose why different room members see different
player sets when the game starts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 11:22:27 -05:00
4 changed files with 42 additions and 6 deletions

View File

@@ -1,3 +1,17 @@
## [2.8.2](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.8.1...v2.8.2) (2025-10-08)
### Bug Fixes
* revert to showing only active players in room games ([87cc0b6](https://github.com/antialias/soroban-abacus-flashcards/commit/87cc0b64fb5f3debaf1d2f122aecfefc62922fed))
## [2.8.1](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.8.0...v2.8.1) (2025-10-08)
### Bug Fixes
* include all players from room members in room games ([28a2e7d](https://github.com/antialias/soroban-abacus-flashcards/commit/28a2e7d6511e70b83adf7d0465789a91026bc1f7))
## [2.8.0](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.7.4...v2.8.0) (2025-10-08)

View File

@@ -198,7 +198,7 @@ export function ArcadeMemoryPairsProvider({ children }: { children: ReactNode })
activePlayers,
},
})
}, [state.gameType, state.difficulty, activePlayers, sendMove])
}, [state.gameType, state.difficulty, activePlayers, sendMove, roomData])
const flipCard = useCallback(
(cardId: string) => {

View File

@@ -8,8 +8,29 @@ import { db, schema } from '@/db'
import type { Player } from '@/db/schema/players'
/**
* Get a user's active players
* These are the players that will participate when the user joins a game
* Get all players for a user (regardless of isActive status)
* @param viewerId - The guestId from the cookie (same as what getViewerId() returns)
*/
export async function getAllPlayers(viewerId: string): Promise<Player[]> {
// First get the user record by guestId
const user = await db.query.users.findFirst({
where: eq(schema.users.guestId, viewerId),
})
if (!user) {
return []
}
// Now query all players by the actual user.id (no isActive filter)
return await db.query.players.findMany({
where: eq(schema.players.userId, user.id),
orderBy: schema.players.createdAt,
})
}
/**
* Get a user's active players (solo mode)
* These are the players that will participate when the user joins a solo game
* @param viewerId - The guestId from the cookie (same as what getViewerId() returns)
*/
export async function getActivePlayers(viewerId: string): Promise<Player[]> {
@@ -30,7 +51,8 @@ export async function getActivePlayers(viewerId: string): Promise<Player[]> {
}
/**
* Get all active players for all members in a room
* Get active players for all members in a room
* Returns only players marked isActive=true from each room member
* Returns a map of userId -> Player[]
*/
export async function getRoomActivePlayers(roomId: string): Promise<Map<string, Player[]>> {
@@ -39,7 +61,7 @@ export async function getRoomActivePlayers(roomId: string): Promise<Map<string,
where: eq(schema.roomMembers.roomId, roomId),
})
// Fetch active players for each member
// Fetch active players for each member (respects isActive flag)
const playerMap = new Map<string, Player[]>()
for (const member of members) {
const players = await getActivePlayers(member.userId)

View File

@@ -1,6 +1,6 @@
{
"name": "soroban-monorepo",
"version": "2.8.0",
"version": "2.8.2",
"private": true,
"description": "Beautiful Soroban Flashcard Generator - Monorepo",
"workspaces": [