diff --git a/Disco.BI/BI/JobBI/Statistics/DailyOpenedClosed.cs b/Disco.BI/BI/JobBI/Statistics/DailyOpenedClosed.cs index 1a90d4b2..beae69ff 100644 --- a/Disco.BI/BI/JobBI/Statistics/DailyOpenedClosed.cs +++ b/Disco.BI/BI/JobBI/Statistics/DailyOpenedClosed.cs @@ -100,7 +100,6 @@ namespace Disco.BI.JobBI.Statistics else { DateTime? previousValue = e.GetPreviousPropertyValue("ClosedDate"); - DateTime? currentValue = e.GetCurrentPropertyValue("ClosedDate"); if (previousValue.HasValue) { @@ -116,21 +115,23 @@ namespace Disco.BI.JobBI.Statistics affectedStat.TotalJobs += 1; } } + } - if (currentValue.HasValue) + DateTime? currentValue = e.GetCurrentPropertyValue("ClosedDate"); + + if (currentValue.HasValue) + { + // Add Statistics + // Remove Statistics + var statItem = _data.FirstOrDefault(i => i.Timestamp == currentValue.Value.Date); + if (statItem != null) { - // Add Statistics - // Remove Statistics - var statItem = _data.FirstOrDefault(i => i.Timestamp == currentValue.Value.Date); - if (statItem != null) - { - statItem.ClosedJobs += 1; - statItem.TotalJobs -= 1; - } - foreach (var affectedStat in _data.Where(i => i.Timestamp > currentValue)) - { - affectedStat.TotalJobs -= 1; - } + statItem.ClosedJobs += 1; + statItem.TotalJobs -= 1; + } + foreach (var affectedStat in _data.Where(i => i.Timestamp > currentValue)) + { + affectedStat.TotalJobs -= 1; } } }