PennController for IBEX › Forums › Support › Not sending results
Tagged: SendResults()
- This topic has 17 replies, 3 voices, and was last updated 4 years, 6 months ago by
Ncomeau.
-
AuthorPosts
-
July 7, 2020 at 6:55 am #5757
irenecg
ParticipantHi Jeremy,
I’m having a problem with the SendResults(): my experiment is not sending them at all. Let me explain:
I have an experiment that is quite long, so I implemented an ‘exit’ button for my participants to leave before if needed. I also have a SendResults() at the very last trial of my experiment (so if people reach the end of the study the results are sent then).
What is happening is, according to my Debug Window, that it sometimes reaches the ‘SendResults’, so it works and sends the results, and sometimes it does not.
I have not been able to identify what exactly makes it not work — for the last two times I tried, re-updating the PennController.js made the experiment work! But it also worked to copy the experiment and run the copy (until it stopped working again).It may be important to comment that I have a MediaRecorder element that is recording the video of the participant for the whole trial, and, at the end of each trial, a MouseTracker element to track where participants click. I don’t know whether these could cause trouble.
The study is long, so I’m not sending you the whole code, but I implemented the ‘exit’ button like this:
newCanvas("confirmation", '55vw', '50vh') .css({"background-color": "floralwhite", 'z-order': '9999'}) .add( "middle at 50%", "center at 25%" , newText("Are you sure you want to quit now?").center() ) .add("middle at 50%", "center at 50%", newCanvas("quitting-selector","20vw", "20vh") .add("middle at 10%", "center at 50%", newButton( "quit", "Quit").css("background-color","green").size("10vw", "10vh")) .add("middle at 90%", "center at 50%", newButton( "Notquit", "NO").css("background-color","red").size("10vw", "10vh")) ) , newButton("stop", "Quit") .css("background-color","red") .callback( getCanvas("confirmation") .print("center at 50vw", "middle at 50vh") , newSelector("quitting-selector").add(getButton("quit"), getButton('Notquit')) .wait() .test.selected(getButton("quit")) .success( getMediaRecorder("fam-"+row.exp_condition).stop(), clear(), SendResults(), newButton("fam-neverLeave").wait()) .failure(getCanvas('confirmation').remove(),getButton('stop').refresh()) ) .print("center at 95vw","middle at 95vh")
And the final ‘SendResults’ is in a trial called ‘bye’, which comes at the very end of my sequence:
Sequence( 'introduction','checkloadings-fam','instructions',"startRecording",'checkloadings-test','familiarization', 'sendrecords', 'introTrials', sepWith("sendrecords",'test_trial'),'sendrecords-end','bye') newTrial('bye', SendResults() , newButton("neverLeaveEnd").wait() ) .log('ID', getVar("ID"))
Another element, which I’m not sure whether it’s relevant in that case, is that when I use the InitiateRecorder() to use my MediaElement there appears a last trial in the Sequence tab of the DebugWindow, called ‘Undefined’, in which there is a message that says that ‘Please wait while the archive of your recordings is being uploaded to the server…’ that never disappears and keeps stuck there. It happens so even if there if the trial in which the ‘MediaElement’ appears is not in the Sequence (so it is unused).
Thank you so much,
Irene
July 7, 2020 at 12:16 pm #5759Jeremy
KeymasterHi Irene,
It’s hard to tell what’s happening without the full context. If you don’t mind, it would be easier if you could send me the link to your experiment. One explanation could be that the MediaRecorder element is no longer active when the stop command on it tries to run, making the script crash before it can reach SendResults. Also, just to clarify, this early-exit bit of code is inside the Template command, right?
Re. the undefined trial getting stuck, do your sendrecords trials work as expected? That is, do they effectively upload the recordings?
Jeremy
July 7, 2020 at 12:45 pm #5761irenecg
ParticipantHi Jeremy,
Sure. The experiment is here, let me know if you’d like to have a look at the script.
I think at that moment the media recording should be active since it stops it and reaches the ‘clear()’ function. And if you reach the end of the experiment, it doesn’t save anyway…Re. the undefined trial getting stuck, do your sendrecords trials work as expected? That is, do they effectively upload the recordings?
Yes, they do. My solution has been to block this undefined trial, so the experiment never reaches there. If I let it run, I find in the server, besides my recordings, a corrupted file-recorder.
Thank you so much!
July 7, 2020 at 1:42 pm #5765Jeremy
KeymasterI’ll have to spend more time on this and be able to replicate the problem before I can (try to) fix it
In the meantime, can you try this hack? Replace you Sequence command with this:
Sequence( sepWith("trytoquit" , seq( 'introduction',"checkloadings-introExp", 'callibration','checkloadings-fam','instructions','checkloadings-introTest',"startRecording",'consent','checkloadings-test',"important-points","getkid", 'introExp','familiarization', 'sendrecords', 'introTrials', sepWith("sendrecords",'test_trial'),'sendrecords-end','bye' ) ) ) //order of trials
Add this to your Header:
newVar("shouldquit",false).global()
And add this trial to your script:
newTrial( "trytoquit" , getVar("shouldquit").test.is(true).success( SendResults() , clear() , newButton().wait() ) )
Then replace your SendResults command (and the following commands) in your success commands with this:
getVar("shouldquit").set(true),end()
This way, your script will try to quit the experiment early after every single trial, but will effectively do so only if the shouldquit Var element is true, ie. only after a click on the Sortir button.
Hopefully this should fix the main problem (I think the corrupted file is unrelated)
Jeremy
July 8, 2020 at 7:23 am #5773irenecg
ParticipantHi Jeremy,
I’ve tried it and at the beginning it was working but after three times I tried it stopped working. However, I now think that the problem is not with ‘SendResults()’ but with ‘ending’ the trial when they click the exit button. Let me try to explain:
When clicking the ‘exit’ button, according to the debug Window, the program should execute:
getVar("shouldquit").set(true), end()
Instead, what it does is just:
getVar("shouldquit").set(true)
And it never reaches the ‘end()’ function, so it gets stuck there. In fact, it does the same it did when I had my ‘SendResults()’ there (that is, to get stuck before the important piece, be it ‘end()’or ‘SendResults()’). I feel there is something that does not let it continue (maybe the MediaRecorder? But I’ve tried to remove it and it had no effect)…
My temporary solution right now has been this one:
newTrial( "trytoquit" , <strong>SendResults()</strong> , getVar("shouldquit").test.is(true).success( clear() , newButton().wait() ) )
and to suppress the warning message of not sending results more than once through the code you provided in another post. In that way it does not save when you press ‘exit’ but at least it saves at the end of each trial (which makes result file super long, and makes me afraid of interfering with some other process of the program thus making it crash from somewhere else, but lets me get the data)…
Again, thanks a million.
Irene
July 8, 2020 at 11:49 am #5776Jeremy
KeymasterHi Irene,
I’ve unfortunately been unable to reproduce the problem so far. Would you mind opening your javascript console (https://www.techonthenet.com/js/open_console_log.php) and check whether you see any error message in those cases when sending the results fails? (don’t mind the warning messages about 404 errors)
If you see something about controllers.running being undefined then it means I’ve (partly) identified the problem.
Thanks,
JeremyJuly 9, 2020 at 3:29 am #5778irenecg
ParticipantHi Jeremy,
This is what the console is telling me:
And the screen goes blank.
-
This reply was modified 4 years, 7 months ago by
irenecg.
July 9, 2020 at 11:33 am #5781Jeremy
KeymasterHi Irene,
It’s a problem with the MouseTracker element then. I think it happens when you exit the experiment before the trial has reached the line newMouseTracker("mouse"). Try moving this line at the top of the trial (i.e. after newTrial("test_trial",) and of course use getMouseTracker("mouse") instead where the line currently is.
Let me know if this fixes the problem
Jeremy
July 10, 2020 at 12:12 pm #5786irenecg
ParticipantHi Jeremy,
I think it worked, the problem disappeared (and also the signaling in the javascript console).
However, the second time I tried, it told me that there had been a problem with sending my results (and asked me to retry). By retrying a couple of times the results were sent without problems. I suspect that it was something not related (maybe due to my local connection at that moment or so), but just in case, I’m also posting what the javascript Console told me:
Thanks,
Irene
July 10, 2020 at 1:07 pm #5787Jeremy
KeymasterHi Irene,
Thank you for the feedback. These 500 and 502 errors mean that there were problems with the server, which is a little concerning in itself, but the good news is that there is no problem on your side. Hopefully these errors won’t occur often, and clicking “Retry” will take care of it.
Jeremy
July 22, 2020 at 7:21 pm #5849Ncomeau
ParticipantWorks like a charm, thanks again Jeremy!
Just a heads up for anyone else trying to use this, I had Send_results() in my sequence before the “end” trial and that seemed to break this method. Moving the call to right at the beginning of the end trial fixed it.August 7, 2020 at 2:13 pm #5893Ncomeau
ParticipantHi again Jeremy,
I’m just about ready to publish my experiment on prolific, but while running some sanity checks today I noticed that in turning the debugger off I’ve somehow broken the quit trial (sends results and displays a canvas telling the participant to return to prolific). With the debugger on, the message displays properly but when I turn it off the experiment hangs on a black screen with the quit button still present where it’s position on any given trial. Any ideas why this may be the case?
Nickolas
August 7, 2020 at 3:46 pm #5894Jeremy
KeymasterHi Nickolas,
I don’t think I’ve experienced this problem before, would you mind sending me a link to your experiment?
Jeremy
August 7, 2020 at 5:31 pm #5895Ncomeau
ParticipantI sent a link to the admin@pcibex.net email. Let me know if you have any trouble with it!
August 7, 2020 at 8:28 pm #5900Jeremy
KeymasterThere’s a problem with the code handling SendResults used as an in-trial command. Edit your file PennController.js and replace occurrences of e=window.items.indexOf(n); (there should be 2) with e=window.items&&window.items.indexOf(n);
Also, the audio replays if I type ‘r’ in my feedback comments—not sure how to prevent that as a general behavior, but it would involve a disable on the Key element that replays, or a printed test inside the Key element’s callback
Jeremy
-
This reply was modified 4 years, 7 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.