amaatouq / netwise

open source project to tackle the problem of long development cycles required to produce software to conduct multi-participant and real-time human experiments online.
1 stars 0 forks source link

game.treatment is undefined on the server #34

Closed amaatouq closed 6 years ago

amaatouq commented 6 years ago

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)

npaton commented 6 years ago

Yep, there's a good chance I didn't make the API exactly the same by mistake, I'll take a look at it, it shouldn't be much. Thanks!

On Mon, Apr 16, 2018 at 3:15 AM, Abdullah notifications@github.com wrote:

Assigned #34 https://github.com/amaatouq/netwise/issues/34 to @npaton https://github.com/npaton.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/amaatouq/netwise/issues/34#event-1575071192, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAlzn1J1iXNlur4qKkzXJD4qFEQdKiVks5to5w3gaJpZM4TVmuA .