Example #1
0
        public TeamCapacity(
            IterationApiResponse iteration,
            IEnumerable <IterationDayOff> iterationDaysOff       = null,
            TeamMemberListApiResponse teamMembers                = null,
            IterationCapacityListApiResponse iterationCapacities = null)
        {
            if (iteration == null)
            {
                throw new ArgumentNullException(nameof(iteration));
            }

            var iterationWorkDays = GetIterationWorkDays(iteration).OrderBy(x => x).Distinct().ToList();

            var teamDaysOff = GetTeamDaysOff(iterationDaysOff).OrderBy(x => x).Distinct().ToList();

            var workDays = iterationWorkDays.Except(teamDaysOff).OrderBy(x => x).Distinct().ToList();

            var members = GetMembers(teamMembers?.Value, iterationCapacities?.Value, iterationWorkDays, teamDaysOff)
                          .ToList();

            IterationWorkDays = new ReadOnlyCollection <DateTime>(iterationWorkDays);
            Members           = new ReadOnlyCollection <TeamMemberCapacity>(members);
            TeamDaysOff       = new ReadOnlyCollection <DateTime>(teamDaysOff);
            WorkDays          = new ReadOnlyCollection <DateTime>(workDays);
        }
Example #2
0
 public TeamCapacity(
     IterationApiResponse iteration,
     IterationDaysOffApiResponse iterationDaysOff,
     TeamMemberListApiResponse teamMembers = null,
     IterationCapacityListApiResponse iterationCapacities = null)
     : this(iteration, iterationDaysOff?.DaysOff, teamMembers, iterationCapacities)
 {
 }
Example #3
0
        public Leaderboard(
            TeamMemberListApiResponse teamMembers,
            IterationApiResponse iteration,
            IterationCapacityListApiResponse capacities,
            IterationDaysOffApiResponse teamDaysOff,
            Iteration workIteration)
        {
            if (teamMembers == null)
            {
                throw new ArgumentNullException(nameof(teamMembers));
            }
            if (iteration == null)
            {
                throw new ArgumentNullException(nameof(iteration));
            }
            if (capacities == null)
            {
                throw new ArgumentNullException(nameof(capacities));
            }
            if (teamDaysOff == null)
            {
                throw new ArgumentNullException(nameof(teamDaysOff));
            }
            if (workIteration == null)
            {
                throw new ArgumentNullException(nameof(workIteration));
            }

            IterationName = iteration.Name;

            var teamMemberList = teamMembers.Value.ToList();

            var teamCapacity = new TeamCapacity(iteration, teamDaysOff, teamMembers, capacities);

            var workItems = GetWorkItems(workIteration);

            var scores = LeaderboardScoresHelper.GetScores(iteration, workItems, teamMemberList);

            var leaderboardTeamMembers = GetPlayers(teamMemberList, teamCapacity, scores);

            Players      = new ReadOnlyCollection <Player>(leaderboardTeamMembers);
            TeamCapacity = teamCapacity;

            UnassignedScore = scores.Where(x => x.Key == Guid.Empty).Select(x => x.Value).FirstOrDefault();

            TotalScoreAssistsSum = Players.Sum(x => x.ScoreAssistsSum);
            TotalScoreGoalsSum   = Players.Sum(x => x.ScoreGoalsSum);
            TotalScorePointsSum  = Players.Sum(x => x.ScorePointsSum);

            TotalHoursTotalCount = Players.Sum(x => x.Capacity.HoursTotalCount);
            TotalWorkDayCount    = Players.Sum(x => x.Capacity.TotalWorkDayCount);
        }