From 115a44d76f9bd3c7b28d674b7c2fea221e3a7459 Mon Sep 17 00:00:00 2001 From: I-Have-An-Issue <34550332+I-Have-An-Issue@users.noreply.github.com> Date: Tue, 21 Feb 2023 18:02:59 -0500 Subject: [PATCH] Remove redundant checking --- src/routes/game/start.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/routes/game/start.js b/src/routes/game/start.js index 84b73a6..be351ba 100644 --- a/src/routes/game/start.js +++ b/src/routes/game/start.js @@ -3,18 +3,8 @@ const app = express.Router() const GameJob = require("../../lib/classes/GameJob.js") -function getGameById(id) { - let game - - global.games.forEach((value, key) => { - if (value.placeId == id) game = value - }) - - return game -} - app.get("/:id", async (request, response) => { - const game = global.games.get(getGameById(request.params.id)?.id) + const game = global.games.get(request.params.id) if (game) return response.status(400).json({ error: "Game is running" }) const job = new GameJob()