Skip to content

Commit

Permalink
ENH - allow user specification of timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Aug 17, 2018
1 parent 804fdfd commit 9205731
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions utilities/private/ft_test_report.m
Expand Up @@ -27,7 +27,7 @@
assert(isequal(command, 'report'));
varargin = varargin(2:end);

optbeg = find(ismember(varargin, {'matlabversion', 'fieldtripversion', 'user', 'hostname', 'branch', 'arch', 'showdate', 'showid'}));
optbeg = find(ismember(varargin, {'matlabversion', 'fieldtripversion', 'user', 'hostname', 'branch', 'arch', 'showdate', 'showid', 'timeout'}));
if ~isempty(optbeg)
optarg = varargin(optbeg:end);
varargin = varargin(1:optbeg-1);
Expand All @@ -37,8 +37,9 @@

% varargin contains the file (or files) to test
% optarg contains the command-specific options
showdate = ft_getopt(optarg, 'showdate', false);
showid = ft_getopt(optarg, 'showid', false);
showdate = ft_getopt(optarg, 'showdate', false); if ischar(showdate), showdate = istrue(showdate); end
showid = ft_getopt(optarg, 'showid', false); if ischar(showid), showid = istrue(showid); end
timeout = ft_getopt(optarg, 'timeout', 30); if ischar(timeout), timeout = str2double(timeout); end

% construct the query string that will be passed in the URL
query = '?';
Expand All @@ -50,7 +51,7 @@
end
end

options = weboptions('ContentType', 'json', 'Timeout', 30); % this returns the result as MATLAB structure
options = weboptions('ContentType', 'json', 'Timeout', timeout); % this returns the result as MATLAB structure
url = 'http://dashboard.fieldtriptoolbox.org/api/';

if isempty(varargin)
Expand All @@ -73,10 +74,10 @@
result = renamefields(result, 'createDate', 'date');

% remove some of the fields
if ~istrue(showid)
if ~showid
result = removefields(result, 'id');
end
if ~istrue(showdate)
if ~showdate
result = removefields(result, 'date');
end

Expand Down

0 comments on commit 9205731

Please sign in to comment.