Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -37,7 +37,11 @@ export class GenerateBoardCommandHandler {
|
||||
);
|
||||
|
||||
const executionTime = Date.now() - startTime;
|
||||
<<<<<<< HEAD
|
||||
logOther(`Board generation completed for game ${cmd.gameId} in ${executionTime}ms using pattern-based approach`);
|
||||
=======
|
||||
logOther(`Board generation completed for game ${cmd.gameId} in ${executionTime}ms. Error rate: ${boardData.totalErrorRate}%`);
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
|
||||
} catch (error) {
|
||||
logError(`Board generation failed for game ${cmd.gameId}:`, error as Error);
|
||||
@@ -46,6 +50,12 @@ export class GenerateBoardCommandHandler {
|
||||
const errorData: BoardData = {
|
||||
gameId: cmd.gameId,
|
||||
fields: [],
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
border: [],
|
||||
validationResults: {},
|
||||
totalErrorRate: 100,
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
generationComplete: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
generatedAt: new Date()
|
||||
|
||||
@@ -151,6 +151,7 @@ export class JoinGameCommandHandler {
|
||||
isOnline: true
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Check if player name is already in use by a different player
|
||||
const existingPlayerWithName = gameData.currentPlayers.find(
|
||||
p => p.playerName === command.playerName && p.playerId !== command.playerId
|
||||
@@ -160,6 +161,8 @@ export class JoinGameCommandHandler {
|
||||
throw new Error(`Player name "${command.playerName}" is already in use in this game`);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
// Update players list (remove if exists, then add)
|
||||
gameData.currentPlayers = gameData.currentPlayers.filter(p => p.playerId !== command.playerId);
|
||||
gameData.currentPlayers.push(newPlayer);
|
||||
@@ -170,6 +173,12 @@ export class JoinGameCommandHandler {
|
||||
// Store updated data in Redis with TTL (24 hours)
|
||||
await this.redisService.setWithExpiry(redisKey, JSON.stringify(gameData), 24 * 60 * 60);
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// Add player to active players set
|
||||
await this.redisService.setAdd(`active_players:${game.id}`, command.playerId);
|
||||
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
logOther('Game data updated in Redis', {
|
||||
gameId: game.id,
|
||||
gameCode: game.gamecode,
|
||||
@@ -210,6 +219,10 @@ export class JoinGameCommandHandler {
|
||||
gameData.currentPlayers = gameData.currentPlayers.filter(p => p.playerId !== playerId);
|
||||
|
||||
await this.redisService.setWithExpiry(redisKey, JSON.stringify(gameData), 24 * 60 * 60);
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
await this.redisService.setRemove(`active_players:${gameId}`, playerId);
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
}
|
||||
} catch (error) {
|
||||
logError('Failed to remove player from Redis', error instanceof Error ? error : new Error(String(error)));
|
||||
|
||||
@@ -64,7 +64,11 @@ export class StartGameCommandHandler {
|
||||
gamecode,
|
||||
maxplayers: command.maxplayers,
|
||||
logintype: command.logintype,
|
||||
<<<<<<< HEAD
|
||||
createdby: command.userid!,
|
||||
=======
|
||||
createdby: command.userid || null,
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
orgid: command.orgid || null,
|
||||
gamedecks,
|
||||
players: [],
|
||||
|
||||
@@ -28,7 +28,11 @@ export interface ActiveGamePlayData {
|
||||
turnSequence: string[]; // Ordered array of player IDs based on turnOrder
|
||||
websocketRoom: string;
|
||||
gamePhase: 'starting' | 'playing' | 'paused' | 'finished';
|
||||
<<<<<<< HEAD
|
||||
boardData: BoardData; // Generated board with fields
|
||||
=======
|
||||
boardData: BoardData; // Generated board with fields and border
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
}
|
||||
|
||||
export interface GameStartResult {
|
||||
@@ -362,7 +366,13 @@ export class StartGamePlayCommandHandler {
|
||||
logOther(`Board data found for game ${gameId}`, {
|
||||
generationComplete: boardData.generationComplete,
|
||||
hasError: !!boardData.error,
|
||||
<<<<<<< HEAD
|
||||
fieldsCount: boardData.fields ? boardData.fields.length : 0
|
||||
=======
|
||||
fieldsCount: boardData.fields ? boardData.fields.length : 0,
|
||||
borderLength: boardData.border ? boardData.border.length : 0,
|
||||
totalErrorRate: boardData.totalErrorRate
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
});
|
||||
|
||||
if (boardData.generationComplete) {
|
||||
@@ -372,7 +382,13 @@ export class StartGamePlayCommandHandler {
|
||||
}
|
||||
|
||||
logOther(`Board generation completed for game ${gameId}`, {
|
||||
<<<<<<< HEAD
|
||||
fieldCount: boardData.fields.length,
|
||||
=======
|
||||
errorRate: boardData.totalErrorRate,
|
||||
fieldCount: boardData.fields.length,
|
||||
borderLength: boardData.border.length,
|
||||
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
|
||||
waitTime: Date.now() - startTime
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user