private JiraIssueStatistics ComputeStatistics() { var splitInterval = TimeSpan.FromHours(1); var accumulator = new JiraIssueStatistics(); return(this._issue.Changes .SplitOverTime(splitInterval) .Lag(this.IsRelevantChange) .Aggregate(accumulator, AccumulateJiraStatistics)); }
private static JiraIssueStatistics AccumulateJiraStatistics(JiraIssueStatistics accumulator, ILag <JiraIssueChange> pair) { var(prevChange, nextChange) = pair; var changeCategory = prevChange.RealCategory; var actualDuration = nextChange.Timestamp - prevChange.Timestamp; accumulator.AddCategoryDuration(changeCategory, actualDuration); if (changeCategory == JiraStatusCategory.InProgress) { accumulator.AddPersonDuration(prevChange.Author, actualDuration); } return(accumulator); }