Data Not Being Saved in PsychoJS Experiment

URL of experiment:

Description of the problem:
Hello everyone,

I’m experiencing an issue with my PsychoJS experiment where certain data doesn’t seem to be saved properly. I’ve gone through my code multiple times and checked my console logs, but everything seems in order.

Here’s a brief overview:

  1. I have set up variables to capture responses and compute scores in the experiment.
  2. In the ‘End Experiment’ section of the code, I’m calculating the scores and logging them to the console. The console logs show the data correctly.
  3. I’m using the psychoJS.experiment.addData method to add this data to the experiment’s results.
  4. However, when I check the downloaded CSV file or database after running the experiment (either in Pilot or Running Mode), these specific data points are missing. The rest of the data seems to be there.

relevant Code:
// … (code to calculate scores) …

console.log(Total Correct: ${window.total_correct});
console.log(Total Wrong: ${window.total_wrong});
// … (more logs) …

expData[‘total_correct’] = window.total_correct;
expData[‘total_wrong’] = window.total_wrong;
// … (more data assignments) …

psychoJS.experiment.addData(‘total_correct’, expData[‘total_correct’]);
psychoJS.experiment.addData(‘total_wrong’, expData[‘total_wrong’]);
// … (more data additions) …

console.log(“Experiment gespeichert”);

Console Outpiut:
Total Correct: 30
Total Wrong: 1
// … (more logs) …
Dateneingelesen
Datengespeichert
Data added: total_correct 30
Experiment gespeichert

Yet, this data is not present in the output CSV or database.

Has anyone encountered a similar issue or can provide some insights into what might be going wrong?

Any help would be greatly appreciated. Thank you in advance!