public IEnumerable <DailyWorkHistory> CalculateWorkHistory(Sprint sprint, JiraGraph node) { var sprintDays = sprint.GetDays().ToArray(); var workLogs = node.GetWorkLogs().ToArray(); TimeSpan timeSpentSoFar = TimeSpan.Zero; var totalTimeSpent = TimeSpan.FromMinutes(workLogs .Where(p => p.Start >= sprint.Start && p.Start < sprint.End) .Sum(p => p.TimeSpent.TotalMinutes)); var timeEstimated = TimeSpan.FromMinutes((double)node.GetTotalStoryPoints() * sprint.TimePerStoryPoint.TotalMinutes); foreach (var day in sprintDays) { var historyForDay = CalculateWorkHistoryForDay(day, workLogs, timeSpentSoFar, timeEstimated, totalTimeSpent); timeSpentSoFar = historyForDay.TimeSpentSoFar; yield return(historyForDay); } }