Draft for challenges + games handling in main hall
[vchess.git] / client / src / data / challengeCheck.js
index 0a3a991..17cf296 100644 (file)
@@ -50,15 +50,17 @@ export function checkChallenge(c)
       return "Increment must be positive";
     c.increment = timeUnitToSeconds(incrementValue, incrementUnit);
   }
+  else
+    c.increment = 0;
 
        // Basic alphanumeric check for players names
        let playerCount = 0;
-       for (p of c.players)
+       for (const pname of c.to)
        {
-               if (p.name.length > 0)
+               if (pname.length > 0)
                {
       // TODO: slightly redundant (see data/userCheck.js)
-                       if (!p.name.match(/^[\w]+$/))
+                       if (!pname.match(/^[\w]+$/))
                                return "Wrong characters in players names";
                        playerCount++;
                }