From cd3be8cc107e25ab587c3df1c0a09cfc071ac176 Mon Sep 17 00:00:00 2001
From: Jan Lemmer <jan.lemmer@fst.tu-darmstadt.de>
Date: Wed, 24 Nov 2021 13:06:10 +0100
Subject: [PATCH] Small changes in CSV export

---
 +PlotID/Publish.m | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m
index b94c5cf..fe2e707 100644
--- a/+PlotID/Publish.m
+++ b/+PlotID/Publish.m
@@ -102,7 +102,7 @@ switch options.Location
            storPath = configObj.exportPath;
         else
            msg = ['Your Export folder ', storPath, newline,...
-                'does not exist - publishing  not possible'];         
+                'does not exist, check the config file - publishing  not possible!'];         
            dlgObj.error(msg);
         end
     case 'server' %legacy
@@ -245,17 +245,6 @@ catch
    dlgObj.softError('Plot export was not successful');
 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
 % if no error orcurred or if force publish is activated, rename the hidden
 % folder to a non hidden one, otherwise delete it.
@@ -269,6 +258,19 @@ if dlgObj.success || options.ForcePublish
     status = movefile(oldPath,newPath); %rename directory
 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 
     disp(['publishing of ', ID , ' to ', newPath, ' done']); %always displayed onsucess   
 else % publish was not sucessfull! 
-- 
GitLab