amaatouq/netwise

game.treatment is undefined on the server

Closed this issue · 1 comments

For example, onRoundEnd, this code:

console.log(game.treatment)

would print undefined. The actual code that is producing the bug

//TODO: bug here, game.treatment is not defined, unlike on the client side
 //checking whether the game contains shock and whether it is time for it!
 //currentRoundNumber % nRounds/shockRate * nRounds => whether it is time!
 console.log(game);
 const shockTime =
   game.treatment.shockRate > 0 &&
   round.index %
     Math.round(
       game.treatment.nRounds /
         (game.treatment.shockRate * game.treatment.nRounds)
     ) ===
     0;
 //if it is time for a shock to arrive, then shock the players
 // i.e., change the difficulty of the task for them.
 shockTime ? shock(players) : null;

Is the game object in the server is different from the game object in the client (i.e., it seems to be working fine on the client side)