Ejemplo n.º 1
0
        public async Task <IEnumerable <IterationModel> > Iterations(string teamID, string projectID)
        {
            var iterations = await mIterationsRepository.GetIterationsAsync(projectID, teamID);

            return(iterations.OrderByDescending(x => x.StartDate)
                   .Where(x => x.Timescale != IterationModel.IterationTimescale.Future)
                   .Select(x => new IterationModel()
            {
                Name = x.Name + (x.Timescale == IterationModel.IterationTimescale.Current ? " (Current)" : " (Past)"),
                ID = x.ID
            }));
        }
Ejemplo n.º 2
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);
                }
            }
        }