Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
 public async Task <CrossSprintMetricsModel> CrossSprintMetrics(string projectID, string iterationID, int workItemID)
 {
     return(await mMetricsService.GetCrossSprintMetricsAsync(projectID, iterationID, workItemID));
 }