(tic-tac-toe): Updated setGameOutcome to accept outcome as a parameter and integrated it into game result handling
This commit is contained in:
parent
4a58f2e98b
commit
dc62f3a98e
2 changed files with 4 additions and 4 deletions
|
|
@ -14,9 +14,9 @@ export const TicTacToeImpl: Omit<ITicTacToeDb, keyof Database> = {
|
|||
* @param gameId The game we want to write the outcome of.
|
||||
*
|
||||
*/
|
||||
setGameOutcome(this: ITicTacToeDb, id: GameId): void {
|
||||
setGameOutcome(this: ITicTacToeDb, id: GameId, outcome: string): void {
|
||||
// Find a way to retrieve the outcome of the game.
|
||||
this.prepare('INSERT INTO tictactoe (game, outcome) VALUES (@id, "draw" /* replace w/ game outcome */)').run({ id });
|
||||
this.prepare('INSERT INTO tictactoe (game, outcome) VALUES (@id, @outcome)').run({ id });
|
||||
},
|
||||
/**
|
||||
* whole function description
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import * as auth from '@shared/auth';
|
|||
import * as swagger from '@shared/swagger';
|
||||
import * as utils from '@shared/utils';
|
||||
import { Server } from 'socket.io';
|
||||
// import type { TicTacToeImpl } from '@shared/database/mixin/tictactoe';
|
||||
import type { TicTacToeImpl } from '@shared/database/mixin/tictactoe';
|
||||
|
||||
declare const __SERVICE_NAME: string;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ async function onReady(fastify: FastifyInstance, game: TTC) {
|
|||
turn: game.currentPlayer,
|
||||
lastResult: result,
|
||||
});
|
||||
// fastify.db.setGameOutcome(this, "011001");
|
||||
fastify.db.setGameOutcome("011001", result);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue