Skip to content

Commit 1a92b22

Browse files
committed
Water no longer posted to Alyx if experiment is aborted
1 parent a27c33a commit 1a92b22

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

+eui/ExpPanel.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ function expStarted(obj, rig, evt)
206206
end
207207
end
208208

209-
function expStopped(obj, rig, ~)
209+
function expStopped(obj, rig, evt)
210210
% EXPSTOPPED Callback for the ExpStopped event.
211211
% expStopped(obj, rig, event) Updates the ExpRunning flag, the
212212
% panel title and status label to show that the experiment has
@@ -222,8 +222,9 @@ function expStopped(obj, rig, ~)
222222
obj.Root.TitleColor = [1 0.3 0.22]; % red title area
223223
%post water to Alyx
224224
ai = rig.AlyxInstance;
225+
aborted = evt.Data; % aborted experiment flag
225226
subject = obj.SubjectRef;
226-
if ~isempty(ai)&&~strcmp(subject,'default')
227+
if ~isempty(ai)&&~strcmp(subject,'default')&&~aborted
227228
switch class(obj)
228229
case 'eui.ChoiceExpPanel'
229230
if ~isfield(obj.Block.trial,'feedbackType'); return; end % No completed trials

+srv/StimulusControl.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ function onWSReceived(obj, ~, eventArgs)
198198
notify(obj, 'ExpStarting', srv.ExpEvent('starting', ref));
199199
case 'completed'
200200
%experiment stopped without any exceptions
201-
ref = data{2};
202-
notify(obj, 'ExpStopped', srv.ExpEvent('completed', ref));
201+
ref = data{2}; aborted = data{3};
202+
notify(obj, 'ExpStopped', srv.ExpEvent('completed', ref, aborted));
203203
case 'expException'
204204
%experiment stopped with an exception
205205
ref = data{2}; err = data{3};

+srv/expServer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ function handleMessage(id, data, host)
203203
experiment.AlyxInstance = AlyxInstance;
204204
end
205205
experiment.quit(immediately);
206-
send(communicator, id, []);
206+
send(communicator, id, immediately);
207207
else
208208
log('Quit message received but no experiment is running\n');
209209
end

0 commit comments

Comments
 (0)