Branching routine/conditional loop

Dear all,

I’m working on an experiment with @Jbruxelm and @VVV and we encounter some problems with PsychoPy (using version 2020.2.4).

In our experiment, participants will first go through a memorization task which consists of the presentation of 45 words pairs that will be presented 5 times in a randomized order. After memorizing the word pairs, they must complete a ‘recall test’ where they will be presented with the first word of the word pairs and must type in the second word of each word pair. We want participants to have at least a score of 75% (34/45) for the recall test (we do not want the participant to move on to the next phase as soon as he has obtained 75%, he must complete the entire routine). If the participant do not score 75% then he must go through a slightly different memorization phase; this memorization routine will present the 45 word paires only 3 times instead of 5 in the first memorization task. After this second memorization phase, the participant must go through a recall test again, which remains unchanged. We tried to achieve this by creating a ‘dummy loop’ as suggested in this video : Creating a Trial that Branches -- PsychoPy Mini Tutorials - YouTube but we are confronted with a problem. When the participant don’t score 75% the experiment plays the dummy loop but only presenting the first word pair instead of the 45 word pairs that must be presented 3 times. Can anyone help with this? Here’s the code we used in the ‘loopRapp1’ which is the recall routine (trials is the branching loop).

Begin Experiment
number_correct = 0

Begin Routine
textFill = “”
if loopRapp1.thisN == 0:
number_correct = 0

End Routine
#update the number correct
if RecallTextBox.text == target_response:
number_correct = number_correct + 1
if number_correct < 34:
doMemoSiFail = 1
if number_correct > 34:
doMemoSiFail = 0
thisExp.addData (“number_correct”, number_correct)

Sorry if I made some english mistakes,