-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add sample countdown trial that counts down before the start of… #496
Conversation
Visit the preview URL for this PR (updated for commit 642f183): https://ccv-honeycomb--pr496-add-countdown-trial-uqpt9ykm.web.app (expires Wed, 03 Jul 2024 03:44:32 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4ace1dcea913a952d2a1af84b94a4421bf36e610 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's chat about this a little closer on Tuesday? We have a special utils file in the lib/ folder that I think some of these functions would work perfectly! Love the way they're broken out and a little renaming would make them perfect for the entire project!
Fantastic work 🙌
src/experiment/trials/countdown.js
Outdated
export function buildCountdownTrial(ms) { | ||
const waitTime = ms; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename the parameter here to be waitTime
instead of ms
! You note that the time is in milliseconds in the docstring and that's the most common way time is handled in JS so you can be a little more explicit with the variable name of the function
src/experiment/trials/countdown.js
Outdated
/** | ||
* Returns millisecond to minute | ||
* | ||
* @param {*} ms - millisecond |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the types here? It looks like they're almost always a number
* @param {*} ms - millisecond | |
* @param {number} ms - millisecond |
src/experiment/honeycomb.js
Outdated
@@ -47,8 +48,12 @@ export function buildHoneycombTimeline(jsPsych) { | |||
// Builds the trials that make up the end procedure | |||
const endProcedure = buildEndProcedure(jsPsych); | |||
|
|||
// Builds a countdown trial that counts down for 6000ms | |||
const countdownTrial = buildCountdownTrial(6000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this 3000? Just so it's not taking up too much time
@RobertGemmaJr Thank you for these feedbacks! I will go ahead and make those changes, and let's talk about it more on Tuesday's meeting! : ) |
… specific type in docstring, change time for countdown
…or helper functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes discussed about should be changed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful! Thank you for this!
src/experiment/trials/countdown.js
Outdated
function getMinute(ms) { | ||
return Math.floor(ms / 1000 / 60); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be moved into src/lib/utils
!
src/experiment/trials/countdown.js
Outdated
function getSeconds(ms, min) { | ||
return Math.floor((ms - min * 1000 * 60) / 1000); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be moved into sec/lib/utils
!
@YUUU23 You can actually merge this pull request into |
countdown
trial intrials
folder inside honeycomb for counting down given millisecond (ms) before another trial begins:src/experiment/trials/countdown.js
:buildCountdownTrial
function to return the actual JS trial object that counts down and updates the time string every few ms until counted down to 0src/experiment/honeycomb.js
: an example usage of thecountdown
trial to countdown 6000ms and inserted in the experiment timeline