From b3a495c8d0f69c52ab7ce3cb6450f8c0800d935d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tobias=20=C3=98rstad?= <tobiasio@ntnu.no>
Date: Fri, 17 Apr 2020 14:00:29 +0200
Subject: [PATCH] Fixes

---
 backend/api/functions.js  | 1 -
 backend/api/tournament.js | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/backend/api/functions.js b/backend/api/functions.js
index ca8b4a6..f961928 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 c4251f3..18fba71 100644
--- a/backend/api/tournament.js
+++ b/backend/api/tournament.js
@@ -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);
-- 
GitLab