You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Places where upgrading empirica will require some changes in our code
useEffect on updates to player object
We want to be able to run a useEffect when the player object is updated from the server-side. Currently, though, the payer object either takes too long to update or doesn't fire the useEffect (I'm not sure which). Documented in more detail in Updating Client Side with Async Empirica Callbacks empiricaly/empirica#132
Routing around no-games
Currently the no-games page gets displayed on every render, which leads to some unexpected side-effects as we want to stop the player's payment counter when they hit this screen. Currently this is worked around with a delay in the default useEffect(..., []). Documented in noGames is rendered even when games are available empiricaly/empirica#134
// TODO: shouldn't need this timeout in new version
// @npaton
consttimer=setTimeout(()=>{
console.log('Experiment stoppped in intro screens, stopping payment counter');
player.set('playerComplete',true);
},500);
return()=>clearTimeout(timer);
},[]);
Player client-side adjustment of timer rendering
We have a stage which plays a video, and when the video ends, it submits the stage. We want the stage timer to reflect the time remaining in the video. We expect the following code to break in the updated empirica:
Things that are currently broken but we expect the latest empirica to fix
In our version, if there are no batches available, players can still go through the entry steps. These two cypress tests reveal this bug, results viewable on the Cypress Dashboard, and may be related to this issue: Debug
WRN callbacks: introDone without game
#168deliberation-empirica/cypress/e2e/02_Batch_Canceled.js
Lines 26 to 40 in ded9421
deliberation-empirica/cypress/e2e/04_No_Experiments_Available.js
Lines 11 to 20 in ded9421
Places where upgrading empirica will require some changes in our code
We want to be able to run a useEffect when the player object is updated from the server-side. Currently, though, the payer object either takes too long to update or doesn't fire the useEffect (I'm not sure which). Documented in more detail in Updating Client Side with Async Empirica Callbacks empiricaly/empirica#132
deliberation-empirica/client/src/pages/Discussion.jsx
Lines 59 to 69 in ded9421
deliberation-empirica/client/src/intro-exit/VideoCheck.jsx
Lines 71 to 82 in ded9421
We want to be able to tell players in our custom lobby page how many people they are waiting on. Our current code doesn't manage the job as it just says "1 Player" all the time. It seems that even this approach is flawed because what we should really be looking for is players who have completed the intro steps. Documented in Tell people how many are waiting in the lobby with each other #156 and usePlayers returns incomplete player list in custom lobby empiricaly/empirica#133 and TypeError: Cannot read properties of null (reading 'playerCount') #249
deliberation-empirica/client/src/pages/Lobby.jsx
Line 18 in ded9421
Currently the no-games page gets displayed on every render, which leads to some unexpected side-effects as we want to stop the player's payment counter when they hit this screen. Currently this is worked around with a delay in the default
useEffect(..., [])
. Documented innoGames
is rendered even when games are available empiricaly/empirica#134deliberation-empirica/client/src/pages/NoGamesWithSorry.jsx
Lines 46 to 53 in ded9421
We have a stage which plays a video, and when the video ends, it submits the stage. We want the stage timer to reflect the time remaining in the video. We expect the following code to break in the updated empirica:
deliberation-empirica/client/src/pages/NoGamesWithSorry.jsx
Lines 46 to 53 in ded9421
Open questions:
We want to call a JS function stored in another repo (ie, https://github.com/Watts-Lab/surveys/blob/main/src/surveys/team_viability/teamViability.score.js) so that we can have surveys that can be shared between projects, documented here: Issue #215
Is this a reasonable pattern:
Get the score function as a string in onNewBatch, save it to batch and then copy it to game object:
deliberation-empirica/server/src/callbacks.mjs
Lines 254 to 263 in ded9421
Then use
Function
to make it execute:deliberation-empirica/client/src/components/SurveyWrapper.jsx
Line 21 in ded9421
The text was updated successfully, but these errors were encountered: