diff --git a/backend/api/functions.js b/backend/api/functions.js index ca8b4a6fc37c582c4dfb483dd340c66442e4a218..f96192843a06e255c18e34e03929c41aef0642c9 100644 --- a/backend/api/functions.js +++ b/backend/api/functions.js @@ -68,7 +68,6 @@ module.exports = { { $pull: { players: { $in: players } }, $inc: { currentPlayers: -players.length }, - $set: { active: !end }, }, (err, result) => { if (err) { diff --git a/backend/api/tournament.js b/backend/api/tournament.js index 7a285f863b1038fd9f9586c631c6d97ef7284ee7..18fba715bf126417c21f950c0b551f6751731272 100644 --- a/backend/api/tournament.js +++ b/backend/api/tournament.js @@ -175,7 +175,7 @@ router.post("/new", (req, res) => { return; } // returns the tournament - res.json(result); + res.json(result.ops[0]); client.close(); } ); @@ -195,6 +195,11 @@ router.post("/join", (req, res) => { res.sendStatus(500); // Internal server error return; } + + if (!req.body.playerId) { + res.sendStatus(400); + return; + } let playerId; try { playerId = mongo.ObjectID(req.body.playerId);