summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers/project_pipeline_statistics_resolver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/resolvers/project_pipeline_statistics_resolver.rb')
-rw-r--r--app/graphql/resolvers/project_pipeline_statistics_resolver.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/graphql/resolvers/project_pipeline_statistics_resolver.rb b/app/graphql/resolvers/project_pipeline_statistics_resolver.rb
new file mode 100644
index 00000000000..29ab9402f5b
--- /dev/null
+++ b/app/graphql/resolvers/project_pipeline_statistics_resolver.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Resolvers
+ class ProjectPipelineStatisticsResolver < BaseResolver
+ type Types::Ci::AnalyticsType, null: true
+
+ def resolve
+ weekly_stats = Gitlab::Ci::Charts::WeekChart.new(object)
+ monthly_stats = Gitlab::Ci::Charts::MonthChart.new(object)
+ yearly_stats = Gitlab::Ci::Charts::YearChart.new(object)
+ pipeline_times = Gitlab::Ci::Charts::PipelineTime.new(object)
+
+ {
+ week_pipelines_labels: weekly_stats.labels,
+ week_pipelines_totals: weekly_stats.total,
+ week_pipelines_successful: weekly_stats.success,
+ month_pipelines_labels: monthly_stats.labels,
+ month_pipelines_totals: monthly_stats.total,
+ month_pipelines_successful: monthly_stats.success,
+ year_pipelines_labels: yearly_stats.labels,
+ year_pipelines_totals: yearly_stats.total,
+ year_pipelines_successful: yearly_stats.success,
+ pipeline_times_labels: pipeline_times.labels,
+ pipeline_times_values: pipeline_times.pipeline_times
+ }
+ end
+ end
+end