From 5ed83cb48703dc06d4fc58b6d78aee12c3e30b2d Mon Sep 17 00:00:00 2001 From: wasita mahaphanit Date: Mon, 22 Feb 2021 10:37:35 -0500 Subject: [PATCH] feat(taskUtils): have option to return subset to achieve random 54 instead of fully counterbalanced 72 trials; chore: bump version from v1.3.2 to v1.3.3 --- package.json | 4 ++-- src/config/experiment.js | 1 + src/language/en_us.json | 2 +- src/lib/taskUtils.js | 13 ++++++++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 079b80f..deefd1a 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "effort-v1.3.2", + "name": "effort-v1.3.3", "description": "all-in-one app with jsPsych + React + Electron + psiTurk", "author": { "name": "Wasita Mahaphanit (Brown) & Rashi Dhar (Brown CCV)", "email": "wasita@brown.edu", "url": "https://lnccbrown.com" }, - "version": "1.3.2", + "version": "1.3.3", "license": "MIT", "private": true, "main": "public/electron.js", diff --git a/src/config/experiment.js b/src/config/experiment.js index 1fdb73e..b1005f6 100644 --- a/src/config/experiment.js +++ b/src/config/experiment.js @@ -8,6 +8,7 @@ let exptBlock1 = deepCopy(defaultBlockSettings); exptBlock1.probs = ["100%", "100%", "50%", "50%"]; exptBlock1.counterbalance = true; +exptBlock1.get_subset = true; exptBlock1.value = [3, 5, 7]; exptBlock1.effort = [50, 100, 200]; // default vals were: 100, 120, 150 exptBlock1.keys = ["q", "p", "m"]; diff --git a/src/language/en_us.json b/src/language/en_us.json index 3d1d76d..174f34b 100644 --- a/src/language/en_us.json +++ b/src/language/en_us.json @@ -2,7 +2,7 @@ "task": { "name": "Effort Task", "end": "This experiment has ended.", - "version": "v1.3.2" + "version": "v1.3.3" }, "prompt": { "continue": { diff --git a/src/lib/taskUtils.js b/src/lib/taskUtils.js index 032ecf5..a5d720b 100644 --- a/src/lib/taskUtils.js +++ b/src/lib/taskUtils.js @@ -1,5 +1,6 @@ // utilities specific to this app/task import _ from "lodash"; +import { ONLINE } from "../config/main"; // initialize starting conditions for each trial within a block const generateStartingOpts = (blockSettings) => { @@ -39,8 +40,18 @@ const generateStartingOpts = (blockSettings) => { } } } + opts = _.shuffle(opts) - return _.shuffle(opts); + // if get_subset is set to true, + // means that it's partial counterbalance, + // as we won't fully represent all + // trial type combos and thus throw out random 25% of trials + if (ONLINE) { + if (blockSettings.get_subset) { + opts = _.slice(opts, 0, 54) + } + } + return opts } };