diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 00:09:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 00:09:12 +0000 |
commit | d43aaf286fe6b8e8383e73ea580274d8841608d7 (patch) | |
tree | ca03542a55583538a1ec13023dffed20457407b5 /app/models/concerns/usage_statistics.rb | |
parent | 87af6f2e0590af0ed1bb3e5de1bb5d21855a94d2 (diff) | |
download | gitlab-ce-d43aaf286fe6b8e8383e73ea580274d8841608d7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/usage_statistics.rb')
-rw-r--r-- | app/models/concerns/usage_statistics.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/concerns/usage_statistics.rb b/app/models/concerns/usage_statistics.rb new file mode 100644 index 00000000000..d6cafcb22b1 --- /dev/null +++ b/app/models/concerns/usage_statistics.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module UsageStatistics + extend ActiveSupport::Concern + + class_methods do + def distinct_count_by(column = nil, fallback = -1) + distinct.count(column) + rescue ActiveRecord::StatementInvalid + fallback + end + end +end |