summaryrefslogtreecommitdiff
path: root/app/models/users_statistics.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-19 00:09:27 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-19 00:09:27 +0000
commit77d15aff0eaa7dd8a8ce988436a502c5ab6bb55b (patch)
tree7e5a828e67a98dbb3b7eb1f73b569d15bbcf0f45 /app/models/users_statistics.rb
parent8b5c2a4525819c6b18f422b4baa0f6568286909b (diff)
downloadgitlab-ce-77d15aff0eaa7dd8a8ce988436a502c5ab6bb55b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/users_statistics.rb')
-rw-r--r--app/models/users_statistics.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/users_statistics.rb b/app/models/users_statistics.rb
index 5c5f62d5d87..5b4c0ef37d0 100644
--- a/app/models/users_statistics.rb
+++ b/app/models/users_statistics.rb
@@ -11,4 +11,22 @@ class UsersStatistics < ApplicationRecord
:bots,
:blocked
].freeze
+
+ private
+
+ def highest_role_stats
+ return unless Feature.enabled?(:users_statistics)
+
+ {
+ owner: batch_count_for_access_level(Gitlab::Access::OWNER),
+ maintainer: batch_count_for_access_level(Gitlab::Access::MAINTAINER),
+ developer: batch_count_for_access_level(Gitlab::Access::DEVELOPER),
+ reporter: batch_count_for_access_level(Gitlab::Access::REPORTER),
+ guest: batch_count_for_access_level(Gitlab::Access::GUEST)
+ }
+ end
+
+ def batch_count_for_access_level(access_level)
+ Gitlab::Database::BatchCount.batch_count(UserHighestRole.with_highest_access_level(access_level))
+ end
end