summaryrefslogtreecommitdiff
path: root/app/services/product_analytics
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/product_analytics')
-rw-r--r--app/services/product_analytics/build_activity_graph_service.rb13
-rw-r--r--app/services/product_analytics/build_graph_service.rb10
2 files changed, 20 insertions, 3 deletions
diff --git a/app/services/product_analytics/build_activity_graph_service.rb b/app/services/product_analytics/build_activity_graph_service.rb
new file mode 100644
index 00000000000..63108d76afd
--- /dev/null
+++ b/app/services/product_analytics/build_activity_graph_service.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module ProductAnalytics
+ class BuildActivityGraphService < BuildGraphService
+ def execute
+ timerange = @params[:timerange].days
+
+ results = product_analytics_events.count_collector_tstamp_by_day(timerange)
+
+ format_results('collector_tstamp', results.transform_keys(&:to_date))
+ end
+ end
+end
diff --git a/app/services/product_analytics/build_graph_service.rb b/app/services/product_analytics/build_graph_service.rb
index 31f9f093bb9..da54ad4de0e 100644
--- a/app/services/product_analytics/build_graph_service.rb
+++ b/app/services/product_analytics/build_graph_service.rb
@@ -13,15 +13,19 @@ module ProductAnalytics
results = product_analytics_events.count_by_graph(graph, timerange)
+ format_results(graph, results)
+ end
+
+ private
+
+ def format_results(name, results)
{
- id: graph,
+ id: name,
keys: results.keys,
values: results.values
}
end
- private
-
def product_analytics_events
@project.product_analytics_events
end