This commit is contained in:
meelstorm
2025-10-20 08:46:31 +02:00
parent dec036dbcf
commit 745a15b162
7 changed files with 26 additions and 20 deletions

View File

@@ -26,6 +26,7 @@ namespace VisionBuilder.UI.Statistics
private string _fileName;
private string _directoryPath;
private int _total = 0;
private int _errors = 0;
private const string BY_EVENTS_FILE_NAME = "statistics_by_events.csv";
private const string MONTHLY_FILE_NAME = "statistics_month.csv";
@@ -79,6 +80,7 @@ namespace VisionBuilder.UI.Statistics
_total++;
if (obj.HasError)
{
_errors++;
RecordBadImage(obj.ErrorNames.ToArray());
}
sw.Stop();
@@ -89,6 +91,7 @@ namespace VisionBuilder.UI.Statistics
{
_startTime = obj.SessionStarted;
_total = 0;
_errors= 0;
_currentRecipe = obj.RecipeName;
_fileName = BY_EVENTS_FILE_NAME;
_directoryPath = PathSettingsUtils.ConvertVariables(_settings.PathTemplate, _startTime, _startTime,
@@ -155,21 +158,17 @@ namespace VisionBuilder.UI.Statistics
);
}
var totalDefects = 0;
foreach (var defect in _defects)
{
totalDefects += defect.Value;
}
monthStatistics.WriteLine([]);
monthStatistics.WriteLine(
["Total errors", totalDefects.ToString()]
["Total error images", _errors.ToString()]
);
monthStatistics.WriteLine(
["Total produced(including errors)", _total.ToString()]
);
var percentage = _total > 0 ? (double)totalDefects / _total * 100 : 0;
var percentage = _total > 0 ? (double)_errors / _total * 100 : 0;
monthStatistics.WriteLine(
["Error rate", percentage.ToString("F2") + "%"]