Logfiles are created correctly but *sometimes* are empty

URL of the experiment not public due to sensitive data protection. The Javascript file is attached. Please note that the extension is “.py”, not “.js”; this is because Discourse does not allow users to upload .js files; if needed, just change the extension back to .js.
DEC.py (80.0 KB)

Description of the problem: My study is currently in the Running phase. It has been piloted extensively and we did not detect any more bugs before running the experiment. Nevertheless, 1 out of the 5 participants ran so far completed the task normally and without any error (we checked by contacting the participant) and the logfile was correctly created in the “data” folder in GitLab but unlike all the other logfiles, this one remained empty. I would like to point out that the experiment entailed a lot of custom coding in Javascript. Just by examining the Javascript code, would anyone be able to identify a reason why a subject might have finished the experiment normally yet the logfile was not written into?

Thank you a lot, I am sorry for the non-standard way of sharing my code.

Hey!

I’ve got a hunch. I notice that you redirect participants to Qualtrics in the quitPsychoJS function. The standard way of doing this is something like this (from demo_chaining.js · master · Thomas Pronk / demo_chaining · GitLab)

psychoJS.setRedirectUrls('https://example.com/completed', 'https://example.com/cancelled');

While I haven’t closely examined what would happen in your approach, this is my hypothesis: at the end of a task, PsychoJS sends all the data to the Pavlovia and then waits until it receives an acknowledgement that the data was received before redirecting the participant. Perhaps in your approach, the study doesn’t wait for that acknowledgment?

When submission of the data goes fast and smooth, no problems. If there is a hickup, no waiting or retrying, so the data doesn’t arrive.

Thank you, I assume this might have indeed be the problem. I have removed my href and set both the “completed” and “cancelled” URLs to the Qualtrics questionnaire. As far as I can tell, it seems that everything works exactly the same as with my approach but yours definitely feels cleaner.

1 Like

Perfect! Feel free to raise it again if you encounter anything.