From 181f0e989230cf739399962106464ee16b65cc36 Mon Sep 17 00:00:00 2001 From: Zach Watson Date: Thu, 19 Mar 2026 17:20:02 -0700 Subject: [PATCH 1/4] fix mental rotation and remove log statements --- task-launcher/src/tasks/mental-rotation/timeline.ts | 2 +- .../src/tasks/same-different-selection/trials/afcMatch.ts | 1 - task-launcher/src/tasks/shared/helpers/prepareCat.ts | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/task-launcher/src/tasks/mental-rotation/timeline.ts b/task-launcher/src/tasks/mental-rotation/timeline.ts index bc7d7d2a..ecbebea9 100644 --- a/task-launcher/src/tasks/mental-rotation/timeline.ts +++ b/task-launcher/src/tasks/mental-rotation/timeline.ts @@ -207,7 +207,7 @@ export default function buildMentalRotationTimeline(config: Record, return heavyInstructions && taskStore().nextStimulus.trialType === '2D' ? 'mentalRotationInstruct5Downex' : 'generalYourTurn'; } - const numOfTrials = taskStore().totalTrials; + const numOfTrials = corpus.length; taskStore('totalTestTrials', getRealTrials(corpus)); const numOfInitialPracticeTrials = firstBlockPractice.length; const fallbackIndex = numOfInitialPracticeTrials + 4; diff --git a/task-launcher/src/tasks/same-different-selection/trials/afcMatch.ts b/task-launcher/src/tasks/same-different-selection/trials/afcMatch.ts index a268eec5..148d3058 100644 --- a/task-launcher/src/tasks/same-different-selection/trials/afcMatch.ts +++ b/task-launcher/src/tasks/same-different-selection/trials/afcMatch.ts @@ -249,7 +249,6 @@ export const afcMatch = (trial?: StimulusType) => { if ( compareSelections([firstSelection, secondSelection], previousSelections, ['number', 'bgcolor']) ) { - console.log(firstSelection, secondSelection); responseBtns[i].style.animation = 'pulse 2s infinite'; responseBtns[j].style.animation = 'pulse 2s infinite'; animationStarted = true; diff --git a/task-launcher/src/tasks/shared/helpers/prepareCat.ts b/task-launcher/src/tasks/shared/helpers/prepareCat.ts index 48f19f17..a2548b7c 100644 --- a/task-launcher/src/tasks/shared/helpers/prepareCat.ts +++ b/task-launcher/src/tasks/shared/helpers/prepareCat.ts @@ -10,7 +10,7 @@ export function prepareCorpus( downexCorpus?: StimulusType[], fillInSdsDifficulty: boolean = false ) { - const excludedTrialTypes = '3D'; + const excludedTrialTypes = ['3D', 'polygon']; // limit random starting items so that their difficulty is less than 0 const maxTrialDifficulty = 0; const cat: boolean = taskStore().runCat; @@ -59,7 +59,7 @@ export function prepareCorpus( // determine start items const possibleStartItems: StimulusType[] = normedTrials.filter( (trial) => - trial.trialType !== excludedTrialTypes && + !excludedTrialTypes.includes(trial.trialType) && ((taskStore().task == 'egma-math' && trial.block_index === 0) || taskStore().task !== 'egma-math') && Number(trial.difficulty) <= maxTrialDifficulty, ); From 062d149c8dc63404ba7c9b86fb581da250b9d431 Mon Sep 17 00:00:00 2001 From: Zach Watson Date: Thu, 19 Mar 2026 17:29:08 -0700 Subject: [PATCH 2/4] save answer string in child survey --- task-launcher/src/tasks/child-survey/helpers/stimulus.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/task-launcher/src/tasks/child-survey/helpers/stimulus.ts b/task-launcher/src/tasks/child-survey/helpers/stimulus.ts index f350de69..432179a5 100644 --- a/task-launcher/src/tasks/child-survey/helpers/stimulus.ts +++ b/task-launcher/src/tasks/child-survey/helpers/stimulus.ts @@ -189,6 +189,7 @@ export const surveyItem = ({ let responseValue = null; let responseIndex = null; + const t = taskStore().translations; const corpus = taskStore().corpus; const stim = taskStore().nextStimulus; const itemLayoutConfig: LayoutConfigType = layoutConfigMap?.[stim.itemId]; @@ -214,7 +215,8 @@ export const surveyItem = ({ audioFile: stim.audioFile, corpus: corpus, audioButtonPresses: PageAudioHandler.replayPresses, - correct: false, + correct: false, // false because there is no correct answer + answer: stim.distractors[selectedButtonIndex] }); // corpusId and itemId fields are used by ROAR but not ROAD From c0c1af4ca142a9d0a4f1b78f0e7573b7cb9510c6 Mon Sep 17 00:00:00 2001 From: Zach Watson Date: Fri, 20 Mar 2026 16:16:28 -0700 Subject: [PATCH 3/4] block fallback feature for non-English languages and add fallback to mental rotation CAT --- task-launcher/src/index.ts | 1 + .../src/tasks/matrix-reasoning/timeline.ts | 4 +-- .../tasks/memory-game/trials/instructions.ts | 9 ++++-- .../src/tasks/mental-rotation/catTimeline.ts | 31 ++++++++++++++++++- .../shared/helpers/checkFallbackCriteria.ts | 4 +-- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/task-launcher/src/index.ts b/task-launcher/src/index.ts index c2185b2f..e0771aa2 100644 --- a/task-launcher/src/index.ts +++ b/task-launcher/src/index.ts @@ -41,6 +41,7 @@ export class TaskLauncher { const { taskName } = this.gameParams; let { language } = this.gameParams; + taskStore('language', language); // adding this to handle old 'es' variant language param values if (language === 'es') { diff --git a/task-launcher/src/tasks/matrix-reasoning/timeline.ts b/task-launcher/src/tasks/matrix-reasoning/timeline.ts index e892ddce..55538cfd 100644 --- a/task-launcher/src/tasks/matrix-reasoning/timeline.ts +++ b/task-launcher/src/tasks/matrix-reasoning/timeline.ts @@ -59,7 +59,7 @@ export default function buildMatrixTimeline(config: Record, mediaAs const layoutConfigMap: Record = {}; let i = 0; - for (const c of fullCorpus) { + for (const c of (heavyInstructions ? fullCorpus : defaultCorpus)) { const { itemConfig, errorMessages } = getLayoutConfig(c, translations, mediaAssets, i); layoutConfigMap[c.itemId] = itemConfig; if (errorMessages.length) { @@ -148,7 +148,7 @@ export default function buildMatrixTimeline(config: Record, mediaAs downexInstructions5, ], conditional_function: () => { - const run = checkFallbackCriteria() && !fellBack && !heavyInstructions; + const run = checkFallbackCriteria() && !fellBack; if (run) { fellBack = true; } diff --git a/task-launcher/src/tasks/memory-game/trials/instructions.ts b/task-launcher/src/tasks/memory-game/trials/instructions.ts index 41ffe18b..40eecbef 100644 --- a/task-launcher/src/tasks/memory-game/trials/instructions.ts +++ b/task-launcher/src/tasks/memory-game/trials/instructions.ts @@ -144,12 +144,17 @@ const instructions = instructionData.map((data) => { // set the display prompt durations here, since awaiting promise during a display trial is not possible in the jsPsych plugin if (!setPromptDurations) { setPromptDurations = true; - const displayPromptDurations = { + + const displayPromptDurations = taskStore().language === 'en' ? + { 'memoryGameInstruct7Downex': await PageAudioHandler.getAudioDuration(mediaAssets.audio.memoryGameInstruct7Downex), 'memoryGameDisplay': await PageAudioHandler.getAudioDuration(mediaAssets.audio.memoryGameDisplay), 'memoryGameInstruct2Downex': await PageAudioHandler.getAudioDuration(mediaAssets.audio.memoryGameInstruct2Downex), "memoryGameInstruct4Downex": await PageAudioHandler.getAudioDuration(mediaAssets.audio.memoryGameInstruct4Downex), - } + } : + { + 'memoryGameDisplay': await PageAudioHandler.getAudioDuration(mediaAssets.audio.memoryGameDisplay), + } taskStore('displayPromptDurations', displayPromptDurations); } diff --git a/task-launcher/src/tasks/mental-rotation/catTimeline.ts b/task-launcher/src/tasks/mental-rotation/catTimeline.ts index 01a995d2..af0ac4c8 100644 --- a/task-launcher/src/tasks/mental-rotation/catTimeline.ts +++ b/task-launcher/src/tasks/mental-rotation/catTimeline.ts @@ -11,6 +11,7 @@ import { combineMediaAssets, filterMedia, prepareMultiBlockCat, + checkFallbackCriteria, } from '../shared/helpers'; // trials import { @@ -31,6 +32,7 @@ import { practiceTransition, setupStimulusFromCurrentCatBlock, setupNextBlock, + repeatInstructionsMessage, } from '../shared/trials'; import { getLayoutConfig } from './helpers/config'; import { prepareCorpus } from '../shared/helpers/prepareCat'; @@ -167,6 +169,27 @@ export default function buildMentalRotationCatTimeline(config: Record + Number(trial.block_index) === 1 && trial.assessmentStage === 'practice_response' + ); + + let fellBack = false; + const fallbackInstructions = { + timeline: [ + repeatInstructionsMessage, + ...downexInstructions, + ...firstBlockPractice.map((trial) => afcStimulusTemplate(trialConfig, trial)), + ], + conditional_function: () => { + const run = checkFallbackCriteria() && !fellBack; + if (run) { + fellBack = true; + } + + return run; + }, + }; + function addInstructionPractice() { batchedCorpus.forEach((block, index) => { timeline.push(instructionPracticeBlock(index + 1)); @@ -184,7 +207,9 @@ export default function buildMentalRotationCatTimeline(config: Record 'mentalRotationInstruct5Downex')); + timeline.push(practiceTransition( + heavyInstructions ? () => 'mentalRotationInstruct5Downex' : undefined, + )); // push in starting block corpora.start.forEach((trial: StimulusType) => { @@ -197,7 +222,11 @@ export default function buildMentalRotationCatTimeline(config: Record { @@ -9,6 +10,5 @@ export const checkFallbackCriteria = (filterInputTrials: boolean = false) => { } const numIncorrect = incorrectTrials.count(); - - return numIncorrect >= 2; + return numIncorrect >= 2 && taskStore().language === 'en'; }; From e53e987d51dd51b248f5ca3c712311167e72e5fc Mon Sep 17 00:00:00 2001 From: Chrissy Cuskley Date: Tue, 24 Mar 2026 15:53:40 +0000 Subject: [PATCH 4/4] extra gate for young users not using en languages --- task-launcher/src/taskStore/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/task-launcher/src/taskStore/index.ts b/task-launcher/src/taskStore/index.ts index 1ce75fd3..7398164b 100644 --- a/task-launcher/src/taskStore/index.ts +++ b/task-launcher/src/taskStore/index.ts @@ -119,7 +119,9 @@ export const setTaskStore = (config: TaskStoreDataType) => { maxIncorrect: config.maxIncorrect, keyHelpers: config.keyHelpers, runCat: config.cat, - heavyInstructions: config.heavyInstructions || config.userMetadata.age <= 4, + heavyInstructions: + (config.heavyInstructions || config.userMetadata.age <= 4) && + (config.language?.toLowerCase().startsWith('en') ?? false), semThreshold: config.semThreshold, startingTheta: config.startingTheta, storeItemId: config.storeItemId,