Skip to content

Commit

Permalink
get target/answer value from itemLayoutConfig rather than taskStore
Browse files Browse the repository at this point in the history
  • Loading branch information
zwatson2001 committed Oct 11, 2024
1 parent 7facee0 commit 3d835a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions task-launcher/src/tasks/shared/trials/afcStimulus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,8 @@ function doOnFinish(data: any, task: string, layoutConfigMap: Record<string, Lay
// note: nextStimulus is actually the current stimulus
const stimulus = taskStore().nextStimulus;
const itemLayoutConfig = layoutConfigMap?.[stimulus.itemId];
// target is the actual value as a string
const target = taskStore().target;
let responseValue = null
let target = null;

if (stimulus.trialType !== 'instructions') {
if (itemLayoutConfig) {
Expand All @@ -418,7 +417,8 @@ function doOnFinish(data: any, task: string, layoutConfigMap: Record<string, Lay
? keyboardChoices.findIndex(f => f.toLowerCase() === data.keyboard_response.toLowerCase())
: data.button_response;
responseValue = response.values[responseIndex];
data.correct = responseValue === response.target;
target = response.target;
data.correct = responseValue === target;
}

// check response and record it
Expand Down

0 comments on commit 3d835a1

Please sign in to comment.