Skip to content

Commit

Permalink
Minor change to joinGame logic (#40)
Browse files Browse the repository at this point in the history
It is easier if the new player is not included in the game state list

---------

Co-authored-by: sormys <szymonp1806@gmail.com>
  • Loading branch information
Kwasow and sormys authored Apr 30, 2023
1 parent 8afb04f commit 7e6547b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion src/routes/joinGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ router.get(
players: [],
gameMasterHash: sha256(result.rows[0].game_master).toString(),
}
await client.query(createPlayerQuery, createPlayerValues)
await client
.query(getGameInfoQuery, getGameInfoValues)
.then((result) => {
Expand Down Expand Up @@ -108,6 +107,7 @@ router.get(
}
})
})
await client.query(createPlayerQuery, createPlayerValues)
res.send(gameInfo)
}
})
Expand Down
4 changes: 0 additions & 4 deletions src/tests/joinGame.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ test('Join game, correct arguments', async () => {
nickname: gameMasterNick,
playerHash: sha256(gameMasterToken).toString(),
},
{
nickname: playerNick,
playerHash: sha256(playerToken).toString(),
},
],
gameMasterHash: sha256(gameMasterToken).toString(),
}
Expand Down

0 comments on commit 7e6547b

Please sign in to comment.