Beispiel #1
0
        public async Task SeedCaches()
        {
            var teams = await mTeamsRepository.GetTeamsAsync();

            foreach (var team in teams)
            {
                var iterations = await mIterationsRepository.GetIterationsAsync(team.ProjectID, team.ID);

                foreach (var iteration in iterations)
                {
                    if (iteration.Timescale != IterationModel.IterationTimescale.Past)
                    {
                        continue;
                    }

                    var workItems = await mWorkItemsRepository.GetWorkItemsForIterationAsync(team.ProjectID, team.ID, iteration.ID);

                    if (!workItems.Any())
                    {
                        continue;
                    }

                    var metrics = await mMetricsCalculator.GetSprintMetricsAsync(team.ProjectID, team.ID, iteration.ID);

                    await mCache.InsertSprintMetricsAsync(team.ID, iteration.ID, metrics);

                    //Cache cross-sprint metrics for each completed user story in the iteration
                    var crossSprintMetrics = new List <CrossSprintMetricsModel>();
                    var closedUserStories  = workItems.Where(x => x.WorkItemType == "User Story" && x.Closed);

                    foreach (var userStoryItem in closedUserStories)
                    {
                        crossSprintMetrics.Add(await mMetricsCalculator.GetCrossSprintMetricsAsync(team.ProjectID, iteration.ID, userStoryItem.ID));
                    }

                    await mCache.BulkInsertCrossSprintMetrics(iteration.ID, crossSprintMetrics);
                }
            }
        }
Beispiel #2
0
        public async Task <IEnumerable <WorkItemMetricsViewModel> > GetSprintMetrics(string projectID, string teamID, string iterationID)
        {
            var metrics = await mMetricsService.GetSprintMetricsAsync(projectID, teamID, iterationID);

            return(metrics.Select(x => new WorkItemMetricsViewModel(x)));
        }