Exemplo n.º 1
0
 private void UpdatePullRequestEffortKnowledgeMap(IEnumerable <PullRequestReviewerComment> pullRequestReviewComments)
 {
     foreach (var pullRequestReviewComment in pullRequestReviewComments)
     {
         PullRequestEffortKnowledgeMap.Add(
             CanononicalPathMapper.GetValueOrDefault(pullRequestReviewComment.Path),
             UsernameRepository.GetByGitHubLogin(pullRequestReviewComment.UserLogin),
             pullRequestReviewComment.CreatedAtDateTime);
     }
 }
Exemplo n.º 2
0
        public void Initiate(Data.Commit[] commits, CommitBlobBlame[] commitBlobBlames, Developer[] developers, DeveloperContribution[] developersContributions,
                             CommittedChange[] committedChanges, PullRequest[] pullRequests, PullRequestFile[] pullRequestFiles, IssueComment[] issueComments,
                             PullRequestReviewer[] pullRequestReviewers, PullRequestReviewerComment[] pullRequestReviewComments,
                             Dictionary <string, string> canononicalPathMapper, GitHubGitUser[] githubGitUsers, Period[] periods, int firstPeriod, string selectedReviewersType, int?minimumActualReviewersLength, IEnumerable <string> megaDevelopers)
        {
            _logger.LogInformation("{datetime}: Trying to initialize TimeMachine.", DateTime.Now);

            UsernameRepository        = new UsernameRepository(githubGitUsers, developers);
            DevelopersContributions   = developersContributions;
            PullRequestReviewComments = pullRequestReviewComments;
            CanononicalPathMapper     = canononicalPathMapper;

            _events = GetSortedEvents(commits, pullRequests);

            CommitsDic = commits.ToDictionary(q => q.Sha);
            PeriodsDic = periods.ToDictionary(q => q.Id);

            GetDevelopersContributions(developers, developersContributions);
            DevelopersDic = developers.ToDictionary(q => q.NormalizedName);

            PullRequestsDic = pullRequests.ToDictionary(q => q.Number);

            PullRequestEffortKnowledgeMap = new PullRequestEffortKnowledgeMap();
            BlameBasedKnowledgeMap        = GetBlameBasedKnowledgeMap(commitBlobBlames);
            CommittedChangesDic           = GetCommittedChangesDictionary(committedChanges);
            PullRequestFilesDic           = GetPullRequestFilesDictionary(pullRequestFiles);
            PullRequestReviewersDic       = GetPullRequestReviewersDictionary(pullRequestReviewers, pullRequestReviewComments, issueComments);

            _firstSimulationPeriod        = firstPeriod;
            _selectedReviewersType        = selectedReviewersType;
            _minimumActualReviewersLength = minimumActualReviewersLength ?? 0;

            _megaDevelopersSet = megaDevelopers.ToHashSet();

            _logger.LogInformation("{datetime}: TimeMachine is initialized.", DateTime.Now);
        }