(tic-tac-toe): Extended setGameOutcome to include player details in database insertion

This commit is contained in:
apetitco 2025-12-22 19:41:10 +01:00 committed by Maix0
parent 39f71bb4d9
commit fb6566fac9

View file

@ -14,9 +14,9 @@ export const TicTacToeImpl: Omit<ITicTacToeDb, keyof Database> = {
* @param gameId The game we want to write the outcome of. * @param gameId The game we want to write the outcome of.
* *
*/ */
setGameOutcome(this: ITicTacToeDb, id: GameId, outcome: string): void { setGameOutcome(this: ITicTacToeDb, id: GameId, player1: string, player2: string, outcome: string): void {
// Find a way to retrieve the outcome of the game. // Find a way to retrieve the outcome of the game.
this.prepare('INSERT INTO tictactoe (game, outcome) VALUES (@id, @outcome)').run({ id }); this.prepare('INSERT INTO tictactoe (id, player1, player2, outcome) VALUES (@id, @player1, @player2, @outcome)').run({ id, player1, player2, outcome });
}, },
/** /**
* whole function description * whole function description