add started & ended timestamps to game table

This commit is contained in:
Nathaniel Tampus
2023-04-05 21:50:34 +08:00
parent baebc04510
commit 3f851602ea
4 changed files with 27 additions and 12 deletions

View File

@@ -231,6 +231,7 @@ export async function joinAsPlayer(this: Socket) {
name: this.request.session.user.name,
side: "white"
});
game.startedAt = Date.now();
} else if (!game.black) {
const sessionUser = {
id: this.request.session.user.id,
@@ -243,6 +244,7 @@ export async function joinAsPlayer(this: Socket) {
name: this.request.session.user.name,
side: "black"
});
game.startedAt = Date.now();
} else {
console.log("joinAsPlayer: attempted to join a game with already 2 players");
}