From 20025e5379dc844512bd621104ca6a0f7a1b731a Mon Sep 17 00:00:00 2001
From: "narindra.rajohnso" <narindra-hasimanjaka-david.rajohnson@etu.hesge.ch>
Date: Mon, 12 Jun 2023 14:24:50 +0200
Subject: [PATCH] reinitialize the players info if restart

---
 API/src/socket.io/ServerIO.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/API/src/socket.io/ServerIO.ts b/API/src/socket.io/ServerIO.ts
index 560819b..fc98754 100644
--- a/API/src/socket.io/ServerIO.ts
+++ b/API/src/socket.io/ServerIO.ts
@@ -129,8 +129,11 @@ class ServerIO extends IO.Server {
 
         });
         socket.on("restart-game", ()=>{
-            if(Object.keys(this.players).length === 3)
+            if(Object.keys(this.players).length === 3){
                 this.players={};
+                this.playersScore={};
+                this.playersReady={};
+            }
             this.initializeGame(socket);
         })
 
-- 
GitLab