コード例 #1
0
        private QualityGraph CreateProjectQualityGraph(
            CoreQualityMetrics.Model.ProjectsAndMetrics projectsAndMetrics,
            CoreQualityMetrics.Model.ListReleaseReports releaseReports, string project)
        {
            var points = new List <QualityGraphPoint>();

            foreach (var version in releaseReports.ReleaseReports[project])
            {
                var report = new CoreQualityMetrics.Model.ReleaseReport(
                    _webConnection.DownloadReleaseReportJson(project, version),
                    projectsAndMetrics.Metrics);

                int passingMetrics = report.BooleanMetricResults.Count(r => r.Value);
                int totalMetrics   = projectsAndMetrics.Metrics.Count;

                points.Add(new QualityGraphPoint(report.Date, (passingMetrics * 100) / totalMetrics));
            }

            points.Sort((a, b) => a.x.CompareTo(b.x));
            return(new QualityGraph(projectsAndMetrics.Projects[project].name, points));
        }
コード例 #2
0
        private void Update(object notUsed)
        {
            try
            {
                var projectsAndMetrics = new CoreQualityMetrics.Model.ProjectsAndMetrics(
                    _webConnection.DownloadProjectsAndMetricsJson());

                var releaseReports = new CoreQualityMetrics.Model.ListReleaseReports(
                    _webConnection.DownloadReleaseReportsListJson());

                var graphs = new List <QualityGraph>();

                foreach (var project in releaseReports.ReleaseReports.Keys)
                {
                    graphs.Add(CreateProjectQualityGraph(projectsAndMetrics, releaseReports, project));
                }

                OnQualityGraphUpdate(new QualityGraphEventArgs(graphs));
            }
            catch
            {
                OnErrorDownloadingData();
            }
        }