Online experiment stuck on initialising

@wakecarter Thank You for your reply. We also worked with the code component. For example we predefined these variables in the code component (begin routine):
Python

prac_conjr_corr_responses = str(int(prac_congr.data['key_resp.corr'].sum()))
prac_conjr_total = str(prac_congr.nTotal)

JS

prac_conjr_corr_responses = Number.parseInt(prac_congr.data["key_resp.corr"].sum()).toString();
prac_conjr_total = prac_congr.nTotal.toString();

and combined it with this text component

$'You answered '+prac_conjr_corr_responses+' of '+prac_conjr_total_trials+' responses correctly\n\n'

The experiment initialises now online but when it gets to the feedback page, it shows the error message that “prac_congr.data” is not defined.

Therefore I’m guessing it is a translation problem to JS, which I don’t know how to solve. Do you have an additional suggestion? A help page with translation issues between Python and JS would also really help! :slight_smile:

Thank You!
Alex

This may help

Personally I don’t access the trial handler and would keep a manual count of the number of correct responses

1 Like

Thanks a lot for the great tip!

We tried to substitute prac_congr with trials as is suggested in the JS crib sheet, but we get another error that says that “trials” is not defined. Just for clarification - the loop’s name is prac_congr. In the crib sheet it is mentioned that all loops are “trials” in Java Script.

prac_conjr_corr_responses = str(int(trials.data['key_resp.corr'].sum()))
prac_conjr_total = str(trials.nTotal)

Do you have another suggestion or can anybody help with this?