Skip to content
Discussion options

You must be logged in to vote

solved: here is the final code:

function get_bonus() {
    var random_sequence = getRandomInt(conditions_shuffled.length)
    var bonus_sequence = jsPsych.data.get().filter({trial_phase: 'outcome_circumplex', sequence: random_sequence}).select('amt_returned').values
    var bonus_sequence_shuffled = shuf(bonus_sequence)
    var bonus_trials = bonus_sequence_shuffled.slice(0,num_bonus_trials)
    var bonus = bonus_trials.reduce((partialSum, a) => partialSum + a, 0)


    console.log(random_sequence)
    console.log(bonus_sequence)
    console.log(bonus_sequence_shuffled)
    console.log(bonus_trials)
    console.log(bonus)

    return bonus.toFixed(2)
}

var bonus_trial = {
    type: jsPsy…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by samanthareisman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant