示例#1
0
 public BurndownNodeDto[] GetBurndownMetric(int projectId)
 {
     return(Burndown
            .GetMetric(projectId)
            .Select(node => BurndownNodeDto.BuildFrom(node))
            .ToArray());
 }
示例#2
0
        public BurndownTests()
        {
            CalendarMock   = new();
            RepositoryMock = new();
            Burndown       = new(CalendarMock.Object, RepositoryMock.Object);

            RepositoryMock
            .Setup(repository => repository.GetProjectSprints(1))
            .Returns(new[] { new Sprint(0, new(), 7) });
示例#3
0
 public ProjectsController(
     IProjectsRepository directory,
     Burndown burndown,
     Velocity velocity,
     CardCycleTime cardCycleTime)
 {
     Repository    = directory;
     Burndown      = burndown;
     Velocity      = velocity;
     CardCycleTime = cardCycleTime;
 }
示例#4
0
        private static BurndownModel GenerateBurndownModel(Data.Team team, Burndown burndown)
        {
            var burndownModel = new BurndownModel()
            {
                Areas = team.AreaLabels.OrderBy(l => l).ToList(),
                Weeks = new List <WeekBurndownModel>(),
            };

            foreach (var week in burndown.Weeks)
            {
                var weekModel = new WeekBurndownModel()
                {
                    Date  = week.EndDate.ToString("yyyy-MM-dd"),
                    Areas = new List <AreaBurndownModel>(),
                };
                var areaDict = week.Areas.ToDictionary(a => a.Label);
                foreach (var area in burndownModel.Areas)
                {
                    AreaBurndownModel areaModel;
                    if (areaDict.TryGetValue(area, out var areaBurndown))
                    {
                        areaModel = new AreaBurndownModel()
                        {
                            Label    = area,
                            Open     = areaBurndown.Open,
                            Closed   = areaBurndown.Closed,
                            Accepted = areaBurndown.Accepted,
                        };
                    }
                    else
                    {
                        areaModel = new AreaBurndownModel()
                        {
                            Label    = area,
                            Open     = 0,
                            Closed   = 0,
                            Accepted = 0,
                        };
                    }
                    weekModel.Areas.Add(areaModel);
                }
                burndownModel.Weeks.Add(weekModel);
            }

            return(burndownModel);
        }
示例#5
0
        private void OnCurrentIterationChanged()
        {
            DaysInIteration.Clear();
            if (CurrentIteration != null && _iterations.TryGetValue(CurrentIteration, out var iteration))
            {
                var now = DateTime.Now;
                now = new DateTime(now.Year, now.Month, now.Day);
                var startDate  = iteration.StartDate;
                var finishDate = iteration.FinishDate;
                if (iteration.StartDate <= now && now <= iteration.FinishDate)
                {
                    startDate = now;
                }

                if (startDate.HasValue && finishDate.HasValue)
                {
                    for (var current = startDate.Value; current <= finishDate.Value; current = current.AddDays(1))
                    {
                        if (1 <= (int)current.DayOfWeek && (int)current.DayOfWeek <= 5)
                        {
                            DaysInIteration.Add(current.ToString("M/dd") + " " + current.ToString("ddd")[0]);
                        }
                    }
                }
            }

            // Combine both source lists into a single WorkItems list
            var grouped = _workItems
                          ?.Where(x => x.IterationPath.Contains(CurrentIteration))
                          ?.GroupBy(x => x.AssignedTo, (key, items) => new GroupedWorkItems {
                Key = key, Items = items.OrderBy(y => y.Rank)
            })
                          ?.OrderBy(x => x.Key);

            IterationWorkItems.Source = grouped;


            // Sort and group to get burndown information
            Burndown.Clear();
            var individuals = new Dictionary <string, BurndownSummaryGroup>();
            Func <string, BurndownSummaryGroup> getGroup = (string who) =>
            {
                if (individuals.TryGetValue(who, out var group))
                {
                    return(group);
                }

                return(individuals[who] = new BurndownSummaryGroup {
                    Who = who
                });
            };

            if (_workItems != null && _completedWorkItems != null)
            {
                foreach (var workitem in _workItems.Union(_completedWorkItems))
                {
                    BurndownSummaryGroup group;
                    if (workitem.Type == WorkItemType.Bug && !String.IsNullOrEmpty(workitem.ResolvedBy))
                    {
                        group = getGroup(workitem.ResolvedBy);
                    }
                    else
                    {
                        group = getGroup(workitem.AssignedTo);
                    }

                    workitem.TimeSpentOnDate.ForEach(x => group.Add(x));
                }

                // Make sure there's a group for each team member even if they didn't do burndown.
                foreach (var teamMember in grouped)
                {
                    getGroup(teamMember.Key);
                }

                // Incorporate audit issues.
                foreach (var auditIssue in _auditIssues)
                {
                    var group = getGroup(auditIssue.Owner);
                    group.AuditIssues.Add(auditIssue);
                }

                // Only include burndown from the last 2 weeks.
                DateTime cutoff = DateTime.Now.AddDays(-14);
                double   workingDaysSinceCutoff = 10;

                foreach (var group in individuals.Values.OrderBy(x => x.Who))
                {
                    group.SortAndFilter(x => x.Date, x => cutoff <= x.Date);
                    group.TotalAccounted           = group.Sum(x => x.CostChange);
                    group.PercentAccounted         = group.TotalAccounted / workingDaysSinceCutoff;
                    group.TotalRemainingBurndown   = group.Sum(x => x.RemainingDaysChange);
                    group.PercentRemainingBurndown = group.TotalRemainingBurndown / workingDaysSinceCutoff;
                    Burndown.Add(group);
                }

                BurndownSummaryGrouped.Source = Burndown;
            }
            else
            {
                BurndownSummaryGrouped.Source = null;
            }
        }