Hi,
URL of experiment: Michael Cutter / DigitSpan · GitLab
Experiment Description: I’m currently in the process of implementing a digit span task in PsychoPy, which seems to be working when I run it locally. However, I have now attempted to deploy this to Pavlovia, and am having difficulties. It seems to be a problem quite a few people in other topics are having, but unfortunately none of these threads seem to solve my problem.
In the digit span task a series of numbers appear one at a time in the centre of the screen. The length of the sequence varies depending how far into the task participants are. Once the sequence has been completed participants will be asked to recall the sequence, by entering each number using their keyboard, and then pressing the return key. This is done through two separate keyboard components, with one of these being used to enter the answers, and the other to submit the answer/end the routine. I have included screenshots of the keyboard response and trial routine below. After the answer is submitted a feedback screen appears, telling participants whether their answer was correct or wrong. They then move back round a loop, onto the next trial. There are also some code components, although I am not convinced these are important to the problem I am currently having – I am of course happy to give more information if someone thinks this may help though!
The problem: The problem is that the experiment is not properly registering whether the participant’s response is correct or not. For example, if I look at the results file it includes a column stating what participants entered for their answer (column A, in the screen shot below), a column including what the correct answer should be (column R), and a column saying whether or not this answer was correct (column B). I have also added a new column to my results file, which includes an Excel IF statement checking whether the contents of columns A and R are identical, just to check that there is not a subtle difference between the two columns that I am missing. If we look at rows 3, 5, and 6, the answer given is clearly correct, while in rows 2 and 4 it is wrong. However, column B says the answer is wrong regardless.
I have looked into the JavaScript file that was generated when I uploaded the experiment to Pavlovia, and cannot see anything obviously wrong with the parts of the code focused on whether participants gave the right answer. I have included these bits of code for completeness. The first bit of code appears at Line 962 while the second part at Line 1130 of the generated script.
Finally, I should perhaps point out that I had never used PsychoPy/Javascript until about two weeks ago, so there’s a good chance I’ve made what would be considered a very silly/basic mistake!
if (DSAns.status === PsychoJS.Status.STARTED) {
let theseKeys = DSAns.getKeys({keyList: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'], waitRelease: false});
_DSAns_allKeys = _DSAns_allKeys.concat(theseKeys);
if (_DSAns_allKeys.length > 0) {
DSAns.keys = _DSAns_allKeys.map((key) => key.name); // storing all keys
DSAns.rt = _DSAns_allKeys.map((key) => key.rt);
// was this correct?
if (DSAns.keys == corrAns) {
DSAns.corr = 1;
} else {
DSAns.corr = 0;
}
}
} ```
And later:
```javascript
// store data for thisExp (ExperimentHandler)
psychoJS.experiment.addData('DSAns.keys', DSAns.keys);
psychoJS.experiment.addData('DSAns.corr', DSAns.corr);
if (typeof DSAns.keys !== 'undefined') { // we had a response
psychoJS.experiment.addData('DSAns.rt', DSAns.rt);
}
Thanks for any help that you can give me,
Michael