Skip to content

Commit

Permalink
Report: Expose "Reset current report". Alight text in non full report
Browse files Browse the repository at this point in the history
  • Loading branch information
rcassani committed Sep 19, 2024
1 parent 9810c8f commit ad39d25
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions toolbox/process/bst_report.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
% bst_report('Save', sInputs, ReportFile=[])
% bst_report('Save', FileNames, ReportFile=[])
% bst_report('Open', ReportFile=[ask], isFullReport=1)
% bst_report('Reset')
% bst_report('Export', ReportFile, HtmlFile=[ask])
% bst_report('Export', ReportFile, HtmlDir)
% bst_report('Email', ReportFile, username, to, subject, isFullReport=1)
Expand Down Expand Up @@ -66,13 +67,12 @@

%% ===== START =====
function Start(sInputs)
global GlobalData;
% If there were no inputs
if (nargin < 1) || isempty(sInputs)
sInputs = [];
end
% Reset current report
GlobalData.ProcessReports.Reports = {};
Reset();
% Get current protocol description
ProtocolInfo = bst_get('ProtocolInfo');
% Add start entry
Expand All @@ -89,7 +89,7 @@ function Add(strType, sProcess, sInputs, strMsg)
return;
end
if isempty(GlobalData.ProcessReports.Reports) || ~iscell(GlobalData.ProcessReports.Reports) || (size(GlobalData.ProcessReports.Reports,2) ~= 5)
GlobalData.ProcessReports.Reports = {};
Reset();
end
% No input
if isempty(strType)
Expand Down Expand Up @@ -775,7 +775,7 @@ function Info(sProcess, sInputs, strMsg)
ReportMat.Reports = GlobalData.ProcessReports.Reports;
bst_save(ReportFile, ReportMat, 'v7');
% Reset
GlobalData.ProcessReports.Reports = {};
Reset();
end


Expand Down Expand Up @@ -1634,7 +1634,7 @@ function Recall(target)
html = [html sprintf('%d errors and %d warnings', length(iErrors), length(iWarnings)) 10 10];
for iEntry = 1:size(Reports,1)
if ~isempty(Reports{iEntry,1}) && ~isempty(Reports{iEntry,5})
html = [html, Reports{iEntry,5}, ' : ', Reports{iEntry,1}];
html = [html, Reports{iEntry,5}, ' : ', Reports{iEntry,1}, repmat(' ', 1, 7-length(Reports{iEntry,1}))];
if ~isempty(Reports{iEntry,2})
if isstruct(Reports{iEntry,2})
html = [html, 9, ' - ' func2str(Reports{iEntry,2}.Function)];
Expand Down Expand Up @@ -1679,3 +1679,10 @@ function Recall(target)
strElapsed = [strElapsed num2str(eTime(6)) 's'];
end

%% ===== RESET CURRENT REPORT =====
% USAGE: bst_report('Reset')
function Reset()
global GlobalData;
GlobalData.ProcessReports.Reports = {};
end

0 comments on commit ad39d25

Please sign in to comment.