コード例 #1
0
        private TestFailureSummaryModel GetTestFailureSummaryModel(BuildFilterModel filter)
        {
            var failureQuery = _buildUtil
                               .GetTestCaseFailures(filter.StartDate, filter.ViewName)
                               .Where(x => filter.IncludePullRequests || !JobUtil.IsPullRequestJobName(x.BuildId.JobName))
                               .GroupBy(x => x.Identifier)
                               .Select(x => new { Key = x.Key, Count = x.Count() })
                               .OrderByDescending(x => x.Count)
                               .AsEnumerable();

            if (filter.Limit.HasValue)
            {
                failureQuery = failureQuery.Take(filter.Limit.Value);
            }

            var summary = new TestFailureSummaryModel()
            {
                Filter = filter,
            };

            foreach (var pair in failureQuery)
            {
                var entry = new TestFailureSummaryEntry()
                {
                    Name  = pair.Key,
                    Count = pair.Count
                };
                summary.Entries.Add(entry);
            }

            return(summary);
        }
コード例 #2
0
        private BuildResultSummaryModel GetBuildResultSummaryModel(BuildFilterModel filter)
        {
            var model = new BuildResultSummaryModel()
            {
                Filter = filter,
            };

            var queryResult = _buildUtil
                              .GetBuildResults(filter.StartDate, filter.ViewName)
                              .Where(x => filter.IncludePullRequests || !JobUtil.IsPullRequestJobName(x.JobId.Name))
                              .Where(x => x.ClassificationKind != ClassificationKind.Succeeded)
                              .GroupBy(x => x.JobId)
                              .Select(x => new { JobId = x.Key, Count = x.Count() })
                              .OrderByDescending(x => x.Count)
                              .AsEnumerable();

            if (filter.Limit.HasValue)
            {
                queryResult = queryResult.Take(filter.Limit.Value);
            }

            foreach (var entity in queryResult)
            {
                var entry = new BuildResultSummaryEntry()
                {
                    JobId = entity.JobId,
                    Count = entity.Count
                };

                model.Entries.Add(entry);
            }

            return(model);
        }
コード例 #3
0
        private BuildResultModel GetBuildResultModel(string jobName, BuildFilterModel filter)
        {
            var model = new BuildResultModel()
            {
                Filter = filter,
                JobId  = JobId.ParseName(jobName),
            };

            var queryResult = _buildUtil
                              .GetBuildResults(filter.StartDate, jobName, filter.ViewName)
                              .Where(x => filter.IncludePullRequests || !JobUtil.IsPullRequestJobName(x.JobId.Name))
                              .Where(x => x.ClassificationKind != ClassificationKind.Succeeded)
                              .OrderBy(x => x.BuildNumber);

            model.Entries.AddRange(queryResult);
            return(model);
        }
コード例 #4
0
        private TestFailureModel GetTestFailureModel(BuildFilterModel filter)
        {
            var model = new TestFailureModel()
            {
                Filter = filter,
                Name   = filter.Name,
            };

            foreach (var entity in _buildUtil.GetTestCaseFailures(filter.StartDate, filter.Name, filter.ViewName))
            {
                var buildId = entity.BuildId;
                if (!filter.IncludePullRequests && JobUtil.IsPullRequestJobName(buildId.JobName))
                {
                    continue;
                }

                model.Builds.Add(entity);
            }

            return(model);
        }