game.treatment is undefined on the server
Closed this issue · 1 comments
amaatouq commented
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
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 ***@***.***> wrote:
Assigned #34 <#34> to @npaton
<https://github.com/npaton>.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#34 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAlzn1J1iXNlur4qKkzXJD4qFEQdKiVks5to5w3gaJpZM4TVmuA>
.