From 3b193157e4d2e1dd55b1cd03d6d79ab50b905ae3 Mon Sep 17 00:00:00 2001 From: Miles Wells Date: Tue, 15 Oct 2019 20:36:23 +0300 Subject: [PATCH] Fix for converting datetime str input to date --- @Alyx/expFilePath.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/@Alyx/expFilePath.m b/@Alyx/expFilePath.m index 0077867..6a1856b 100644 --- a/@Alyx/expFilePath.m +++ b/@Alyx/expFilePath.m @@ -66,10 +66,10 @@ end % Check date -if ~ischar(expDate)||(ischar(expDate)&&length(expDate)==8) +if ~ischar(expDate) expDate = datestr(expDate, 'yyyy-mm-dd'); -elseif ischar(expDate)&&length(expDate)==19 - expDate = datestr(expDate, 'yyyy-mm-ddTHH:MM:SS'); +elseif ischar(expDate) && length(expDate) > 10 + expDate = expDate(1:10); end if length(varargin) > 1 % Repository location defined @@ -97,11 +97,11 @@ type = dataSets(idx).name; % Ensures correct case % Construct the endpoint -% FIXME: Alyx can't filter by session date, only datetime +% FIXME: datasets endpoint filters no longer work % @body because of this we must make a seperate query to obtain the % datetime. Querying the sessions takes around 3 seconds. Otherwise we % filter by created time under the assumption that the dataset was created -% on the same day as the session. +% on the same day as the session. See https://github.com/cortex-lab/alyx/issues/601 if strictSearch endpoint = sprintf(['/datasets?'... 'subject=%s&'... @@ -125,6 +125,10 @@ subject, num2str(seq), type, user, expDate); records = obj.getData(endpoint); end +% Construct the endpoint +% endpoint = sprintf('/datasets?subject=%s&date=%s&experiment_number=%s&dataset_type=%s&created_by=%s',... +% subject, expDate, num2str(seq), type, user); +% records = obj.getData(endpoint); if ~isempty(records) data = catStructs(records);