JATOS with jspsych saving data local run but not server run
Hi all,
My colleague recently set up a new JATOS server (3.9.3) and unfortunately it is not working as expected. Data save is working perfectly on my local version but when I export the jzip and re-import to the server JATOS, it runs fine but data is 'retrieved' but never posted. I thought that the version of my local jatos could be the issue (was 3.7.x) so I updated it to (v.3.9.5: couldn't find 3.9.3) but same issue. Any ideas of where to start looking? Much appreciated.
Comments
Hi,
The first thing that comes to mind is that the data you're trying to send to the server are too large. How big is one dataset?
No they are tiny text files. When I run my test experiment it is only 35 lines of data, 13kb.
That’s weird.
Then we would need more information, in order to know what might be the problem. Let’s see:
Thanks for this. The example study works fine! The issue seems to be that I was using the command:
on_finish: function(data) {
var results = jsPsych.data.get().ignore(['internal_node_id','button_pressed']).csv();
jatos.submitResultData(results); }
Which works fine on my local version of JATOS (and the server at a previous Uni) but was not posting data to our new server.
So I need to be using the command:
on_finish: () => jatos.endStudy(jsPsych.data.get().csv()).
I need to play around a little with where exactly I use this command to send the data (because at the end of my script it redirects back to Prolific/SONA so the previous submitResultData command was at the end of the last trial), but that seems to be the issue so thanks!
I am still having trouble with this. The following works great indicating that I can submit data to our server:
var jsPsych = initJsPsych({
on_finish: function() {
var results = jsPsych.data.get().ignore(['internal_node_id','button_pressed']).csv();
jatos.endStudy(results)
}
});
However I need to redirect at the end of the study and when I start trying to submit data to the server before the redirect using any other command (e.g., jatos.uploadResultFile or jatos.submitResultData) then the data does not save. Any thoughts?
My first guess is that your data take a bit longer to send to your server, and if you put another command after it, you end up redirecting before the data get the chance to get sent.
Try using jatos.endStudyAndRedirect instead, that relies on a Promise.
You're right, that works. I actually hadn't clicked that you could add results data to that command and it would also submit the data. So jatos.endStudyAndRedirect(completion_url, results) works perfectly. Yay!