From 814f486e1e8f8171ed053379cdae9aa244493d7e Mon Sep 17 00:00:00 2001 From: Dano Morrison Date: Fri, 21 Aug 2020 00:29:08 -0700 Subject: [PATCH] fixed missing parenthesis in teons elegant faceshouse stimulus refactor --- app/utils/labjs/protocols/faceshouses.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/utils/labjs/protocols/faceshouses.ts b/app/utils/labjs/protocols/faceshouses.ts index 98c9a6c8..83db1a68 100644 --- a/app/utils/labjs/protocols/faceshouses.ts +++ b/app/utils/labjs/protocols/faceshouses.ts @@ -8,15 +8,17 @@ const facesDir = path.join(rootFolder, 'assets', 'face_house', 'faces'); const housesDir = path.join(rootFolder, 'assets', 'face_house', 'houses'); const fixation = path.join(rootFolder, 'assets', 'common', 'fixationcross.png'); -const stimuli = Array.from({length:30}, (v,k) => `Face${k+1}`).concat(Array.from({length:30}, (v,k) => `House${k+1}`).map((s) => ({; - condition: s.startsWith('Face') ? 'Face' : 'House', - dir: s.startsWith('Face') ? facesDir : housesDir, - filename: `${s}.jpg`, - name: s, - response: s.startsWith('Face') ? '1' : '9', - phase: 'main', - type: s.startsWith('Face') ? EVENTS.STIMULUS_1 : EVENTS.STIMULUS_2, -})); +const stimuli = Array.from({ length: 30 }, (_, i) => `Face${i + 1}`) + .concat(Array.from({ length: 30 }, (v, k) => `House${k + 1}`)) + .map((s) => ({ + condition: s.startsWith('Face') ? 'Face' : 'House', + dir: s.startsWith('Face') ? facesDir : housesDir, + filename: `${s}.jpg`, + name: s, + response: s.startsWith('Face') ? '1' : '9', + phase: 'main', + type: s.startsWith('Face') ? EVENTS.STIMULUS_1 : EVENTS.STIMULUS_2, + })); // phase: ['Face1', 'House1'].includes(s) ? 'practice' : 'main',