Skip to content
Snippets Groups Projects
Commit 43e96ccd authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Merge branch '90-initialise-angabe-des-ordners-ohne-effekt' into 'development'

Resolve "Initialise: Angabe des Ordners ohne Effekt"

See merge request !36
parents 83fcb8ff cd3be8cc
No related branches found
No related tags found
2 merge requests!43Implements #73, cleans up example file,,!36Resolve "Initialise: Angabe des Ordners ohne Effekt"
Pipeline #592897 passed
...@@ -12,6 +12,7 @@ classdef config < handle ...@@ -12,6 +12,7 @@ classdef config < handle
properties (SetAccess = protected) properties (SetAccess = protected)
configData configData
configFileName configFileName
exportPath = ''
end end
methods methods
...@@ -23,7 +24,10 @@ classdef config < handle ...@@ -23,7 +24,10 @@ classdef config < handle
txt = fileread(obj.configFileName); txt = fileread(obj.configFileName);
obj.configData = jsondecode(txt); obj.configData = jsondecode(txt);
assert(checkConfig(obj)); assert(checkConfig(obj));
if isfield(obj.configData,'ExportPath')
obj.exportPath = obj.configData.ExportPath;
obj.configData.options.Location = 'exportPath';
end
catch catch
msg = ['no valid config File with the filename ',... msg = ['no valid config File with the filename ',...
obj.configFileName, ' found.' newline,... obj.configFileName, ' found.' newline,...
......
...@@ -15,7 +15,7 @@ switch mode ...@@ -15,7 +15,7 @@ switch mode
m = input('Do you want to add an export path? Y/N [Y]:','s'); m = input('Do you want to add an export path? Y/N [Y]:','s');
if ismember(m,{'Y','y'}) if ismember(m,{'Y','y'})
config.ServerPath = uigetdir(); config.ExportPath = uigetdir();
end end
otherwise otherwise
error('wizard mode undefined in CLASS config'); error('wizard mode undefined in CLASS config');
......
...@@ -74,9 +74,13 @@ end ...@@ -74,9 +74,13 @@ end
%% read config file %% read config file
% there is only one config Object (handleClass) % there is only one config Object (handleClass)
configObj = PlotID.config(options.ConfigFileName); configObj = PlotID.config(options.ConfigFileName);
% add user options
if isfield(configObj.configData, 'options') if isfield(configObj.configData, 'options')
% is working but prune to user errors fldnames = fieldnames(configObj.configData.options);
options = configObj.configData.options; for ii=1:numel(fldnames)
field = fldnames{ii};
options.(field) = configObj.configData.options.(field);
end
end end
% Error and MSG handeling % Error and MSG handeling
...@@ -92,14 +96,22 @@ switch options.Location ...@@ -92,14 +96,22 @@ switch options.Location
% use the script path as export path % use the script path as export path
scriptLocation = fileparts(scriptPath); scriptLocation = fileparts(scriptPath);
storPath = fullfile(scriptLocation,options.ParentFolder); storPath = fullfile(scriptLocation,options.ParentFolder);
end
case 'exportPath' %legacy
if isfolder(configObj.exportPath)
storPath = configObj.exportPath;
else
msg = ['Your Export folder ', storPath, newline,...
'does not exist, check the config file - publishing not possible!'];
dlgObj.error(msg);
end end
case 'server' %from config File case 'server' %legacy
if dlgObj.configError if dlgObj.configError
msg = ['Error while reading the config file' newline,... msg = ['Error while reading the config file' newline,...
' publishing on server not possible']; ' publishing on server not possible'];
dlgObj.error(msg); dlgObj.error(msg);
end end
storPath = config.ServerPath; storPath = configObj.configData.ServerPath;
case 'manual' %UI case 'manual' %UI
storPath = uigetdir(); storPath = uigetdir();
case 'CI-Test' case 'CI-Test'
...@@ -233,17 +245,6 @@ catch ...@@ -233,17 +245,6 @@ catch
dlgObj.softError('Plot export was not successful'); dlgObj.softError('Plot export was not successful');
end end
% CSV EXport
if options.CSV
T = table();
T.research_Data = DataPaths'; T.PlotID(:) = {ID};
T.Script_Name(:) = {scriptPath};
T.Storage_Location(:) = {storPath};
T.Date(:) = {datestr(now)};
T = movevars(T,'PlotID','before',1);
writetable(T, fullfile(storPath, 'overview_table.csv'),'WriteMode','append');
end
%% final renaming and error/warning handeling %% final renaming and error/warning handeling
% if no error orcurred or if force publish is activated, rename the hidden % if no error orcurred or if force publish is activated, rename the hidden
% folder to a non hidden one, otherwise delete it. % folder to a non hidden one, otherwise delete it.
...@@ -257,8 +258,21 @@ if dlgObj.success || options.ForcePublish ...@@ -257,8 +258,21 @@ if dlgObj.success || options.ForcePublish
status = movefile(oldPath,newPath); %rename directory status = movefile(oldPath,newPath); %rename directory
end end
%% CSV EXport
% ToDo exclude in function
if options.CSV
T = table();
T.research_Data = DataPaths'; T.PlotID(:) = {ID};
T.Author(:) = {configObj.configData.Author};
T.Script_Name(:) = {scriptPath};
T.Storage_Location(:) = {newPath};
T.Date(:) = {datestr(now)};
T = movevars(T,{'PlotID','Author'},'before',1);
writetable(T, fullfile(storPath, 'PlotID_overview.csv'),'WriteMode','append');
end
if status if status
disp(['publishing of ', ID , ' done']); %always displayed onsucess disp(['publishing of ', ID , ' to ', newPath, ' done']); %always displayed onsucess
else % publish was not sucessfull! else % publish was not sucessfull!
%replace with error from userDLG Class %replace with error from userDLG Class
dlgObj.error(['publishing of ', ID , ' failed']) dlgObj.error(['publishing of ', ID , ' failed'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment