summaryrefslogtreecommitdiff
path: root/app/models/product_analytics_event.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-30 15:09:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-30 15:09:40 +0000
commite65a1b9830b8746fefd18744a39d559cbf58c99e (patch)
treeba99958692b0b28611f0a7141415e774a0b520a6 /app/models/product_analytics_event.rb
parent55b5a8778c6f30a0e03059c59a510ff0d6f5b761 (diff)
downloadgitlab-ce-e65a1b9830b8746fefd18744a39d559cbf58c99e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/product_analytics_event.rb')
-rw-r--r--app/models/product_analytics_event.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/product_analytics_event.rb b/app/models/product_analytics_event.rb
index 607646715e4..579ea88c272 100644
--- a/app/models/product_analytics_event.rb
+++ b/app/models/product_analytics_event.rb
@@ -20,6 +20,10 @@ class ProductAnalyticsEvent < ApplicationRecord
where('collector_tstamp BETWEEN ? AND ? ', today - duration + 1, today + 1)
}
+ def self.count_by_graph(graph, days)
+ group(graph).timerange(days).count
+ end
+
def as_json_wo_empty
as_json.compact
end