Bug Fix: Statistics for Quick-Logged Jobs

Jobs now perform a check when Quick-Logged and update Statistics
accordingly.
This commit is contained in:
Gary Sharp
2014-02-20 10:56:06 +11:00
parent 6ac87633ac
commit 96c5860080
@@ -100,7 +100,6 @@ namespace Disco.BI.JobBI.Statistics
else else
{ {
DateTime? previousValue = e.GetPreviousPropertyValue<DateTime?>("ClosedDate"); DateTime? previousValue = e.GetPreviousPropertyValue<DateTime?>("ClosedDate");
DateTime? currentValue = e.GetCurrentPropertyValue<DateTime?>("ClosedDate");
if (previousValue.HasValue) if (previousValue.HasValue)
{ {
@@ -116,21 +115,23 @@ namespace Disco.BI.JobBI.Statistics
affectedStat.TotalJobs += 1; affectedStat.TotalJobs += 1;
} }
} }
}
if (currentValue.HasValue) DateTime? currentValue = e.GetCurrentPropertyValue<DateTime?>("ClosedDate");
if (currentValue.HasValue)
{
// Add Statistics
// Remove Statistics
var statItem = _data.FirstOrDefault(i => i.Timestamp == currentValue.Value.Date);
if (statItem != null)
{ {
// Add Statistics statItem.ClosedJobs += 1;
// Remove Statistics statItem.TotalJobs -= 1;
var statItem = _data.FirstOrDefault(i => i.Timestamp == currentValue.Value.Date); }
if (statItem != null) foreach (var affectedStat in _data.Where(i => i.Timestamp > currentValue))
{ {
statItem.ClosedJobs += 1; affectedStat.TotalJobs -= 1;
statItem.TotalJobs -= 1;
}
foreach (var affectedStat in _data.Where(i => i.Timestamp > currentValue))
{
affectedStat.TotalJobs -= 1;
}
} }
} }
} }