Trouble Displaying Feedback for all blocks

IIf this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): MacOS Catalina 10.15.7
PsychoPy version (e.g. 1.84.x): 2021.2.3
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?:

Greetings.

I am creating an experiment that features randomized trials in 4 trials blocks. The blocks are also randomized. I would like to provide feedback on the participant’s overall performance at the very end, with a percentage that shows the total number of trials (out of 60) that they got correct. My spreadsheets have a correctAnswer column that specifies the correct key response, and my keyboard response component is set to store last key data and use $correctAnswer for correct answer.

What did you try to make it work?:
Following the instructions for the feedback at the end of a block on this page (Builder - providing feedback — PsychoPy v1.84.0) using a feedback routine. Please see attached images. I include what the loops/routines look like in builder, the code I use for the feedback screen, and initially got a msg error. I removed the independent text component from the routine, and it now flashes a new error (see attached images for the code I am using and the experiment design in builder)

What specifically went wrong when you tried that?:

Draft_lastrun.py", line 5753, in
nCorr = block1trials.data[‘response.corr’].sum()
NameError: name ‘block1trials’ is not defined

Although the instructions don’t specify to do so, I feel that I should probably be putting extra code somewhere in the trial block as well?


Hello erober69

I never used block feedback before. But could it be that the code-line nCorr = ... is at the wrong place? Doesn’t it belong in the block1trials-routine and not in the Feedback-routine?

Best wishes Jens

Thanks! I was able to figure part of the problem out. response.corr was not labelled with the same name as what I had in my own experiment. It now displays!

However, it is only adding up the number of correct answers for the final repetition of the trial block. I need to get it to add up the cumulative total for all 4 repetitions.

Hello erober69

do you reset the count somewhere? The variable must be initialized outside of your repetition loop, otherwise you reset it each repetition.

Best wishes Jens