コード例 #1
0
        private void LoadData()
        {
            var toSkip  = _sprints.Count - _settings.NumberOfLastSprintsAnalysed;
            var sprints = _sprints.Where(s => s.CompleteDate.HasValue).OrderBy(s => s.StartDate).Skip(toSkip);

            foreach (var sprint in sprints)
            {
                var commitment = _boardContent.IssuesInSprint(sprint.Id).Sum(i => i.StoryPoints);
                var completed  = _boardContent.IssuesInSprint(sprint.Id).Where(i => i.Resolved.HasValue && i.Resolved <= sprint.CompleteDate).Sum(i => i.StoryPoints);

                Statistics.Add(new SprintStatistic {
                    SprintName = sprint.Name, Velocity = completed, Commitment = commitment
                });
            }

            var minimumVelocity   = Statistics.Min(s => s.Velocity);
            var maximumVelocity   = Statistics.Max(s => s.Velocity);
            var averageVelocity   = Statistics.Average(s => s.Velocity);
            var minimumCommitment = Statistics.Min(s => s.Commitment);
            var maximumCommitment = Statistics.Max(s => s.Commitment);
            var averageCommitment = Statistics.Average(s => s.Commitment);

            Minimum.Add(new SprintStatistic {
                SprintName = Statistics.First().SprintName, Velocity = minimumVelocity, Commitment = minimumCommitment
            });
            Minimum.Add(new SprintStatistic {
                SprintName = Statistics.Last().SprintName, Velocity = minimumVelocity, Commitment = minimumCommitment
            });
            Maximum.Add(new SprintStatistic {
                SprintName = Statistics.First().SprintName, Velocity = maximumVelocity, Commitment = maximumCommitment
            });
            Maximum.Add(new SprintStatistic {
                SprintName = Statistics.Last().SprintName, Velocity = maximumVelocity, Commitment = maximumCommitment
            });
            Average.Add(new SprintStatistic {
                SprintName = Statistics.First().SprintName, Velocity = averageVelocity, Commitment = averageCommitment
            });
            Average.Add(new SprintStatistic {
                SprintName = Statistics.Last().SprintName, Velocity = averageVelocity, Commitment = averageCommitment
            });
        }