Ejemplo n.º 1
0
        public async Task <IActionResult> TeamDoneEfforts(
            string projectId   = null,
            string teamId      = null,
            string iterationId = null)
        {
            var idParams = await GetEnsuredIdParams(projectId, teamId, iterationId);

            var efforts = await _workIterationAppService.GetWorkIterationDoneEffortsPerDay(
                idParams.ProjectId,
                idParams.TeamId,
                idParams.IterationId);

            var jsonData = efforts.Select(x => new object[] { x.Key, x.Value }).ToList();

            return(Json(jsonData));
        }
Ejemplo n.º 2
0
        private async Task <Activity> GetActivityInternal(string projectId, string teamId, string iterationId)
        {
            var iteration = await _iterationsApi.Get(projectId, teamId, iterationId);

            var fromDate = iteration?.Attributes?.StartDate ?? DateTime.Now;
            var toDate   = iteration?.Attributes?.FinishDate ?? fromDate.AddDays(DefaultActivityDays);

            var capacitiesTask   = _iterationsApi.GetCapacities(projectId, teamId, iterationId);
            var repositoriesTask = _gitApi.GetRepositoryList(projectId);
            var teamDaysOffTask  = _iterationsApi.GetTeamDaysOff(projectId, teamId, iterationId);
            var teamMembersTask  = _teamsApi.GetAllTeamMembers();

            var effortDoneTask =
                _workIterationAppService.GetWorkIterationDoneEffortsPerDay(projectId, teamId, iterationId);

            await Task.WhenAll(capacitiesTask, repositoriesTask, teamDaysOffTask, teamMembersTask, effortDoneTask);

            var capacities   = capacitiesTask.Result;
            var repositories = repositoriesTask.Result;
            var teamDaysOff  = teamDaysOffTask.Result;
            var teamMembers  = teamMembersTask.Result;
            var effortDones  = effortDoneTask.Result;

            var commitInfoTasks = repositories
                                  .Value
                                  .Select(async x => await GetCommitInfo(x.Id, repositories.Value, teamMembers.Value, fromDate, toDate))
                                  .ToList();

            await Task.WhenAll(commitInfoTasks);

            var commitInfo = commitInfoTasks.SelectMany(x => x.Result).ToList();

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

            return(new Activity(commitInfo, fromDate, toDate, teamCapacity, effortDones, iteration));
        }