Esempio n. 1
0
        /// <summary>
        /// A view of the builds grouped by the result.
        /// </summary>
        /// <returns></returns>
        public ActionResult View(bool pr = false, DateTimeOffset?startDate = null, string viewName = AzureUtil.ViewNameRoslyn)
        {
            var filter  = CreateBuildFilter(actionName: nameof(View), viewName: viewName, startDate: startDate, pr: pr);
            var results =
                _buildUtil.GetBuildResults(filter.StartDate, viewName)
                .Where(x => pr || !JobUtil.IsPullRequestJobName(x.JobId))
                .ToList();

            var totalCount     = results.Count;
            var totalSucceeded = results.Count(x => x.ClassificationKind == ClassificationKind.Succeeded);

            var builds = results
                         .Where(x => x.ClassificationKind != ClassificationKind.Succeeded)
                         .GroupBy(x => x.ClassificationName)
                         .Select(x => new BuildViewModel()
            {
                KindName = x.Key, Count = x.Count()
            })
                         .ToList();

            var model = new BuildViewSummaryModel()
            {
                Filter              = filter,
                TotalBuildCount     = totalCount,
                TotalSucceededCount = totalSucceeded,
                Builds              = builds
            };

            return(View(viewName: "View", model: model));
        }