Commit a453ea9b authored by manojmj's avatar manojmj

Do not add Project, User, Group counts in API

parent 1f1257a2
......@@ -3,8 +3,7 @@
class Admin::DashboardController < Admin::ApplicationController
include CountHelper
COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue,
MergeRequest, Note, Snippet, Key, Milestone].freeze
COUNTED_ITEMS = [Project, User, Group].freeze
# rubocop: disable CodeReuse/ActiveRecord
def index
......
......@@ -1199,18 +1199,6 @@ module API
approximate_count_with_delimiters(counts, ::Milestone)
end
expose :users do |counts|
approximate_count_with_delimiters(counts, ::User)
end
expose :projects do |counts|
approximate_count_with_delimiters(counts, ::Project)
end
expose :groups do |counts|
approximate_count_with_delimiters(counts, ::Group)
end
expose :active_users do |_|
number_with_delimiter(::User.active.count)
end
......
......@@ -4,7 +4,7 @@ module API
class Statistics < Grape::API
before { authenticated_as_admin! }
COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue,
COUNTED_ITEMS = [ForkNetworkMember, ForkNetwork, Issue,
MergeRequest, Note, Snippet, Key, Milestone].freeze
desc 'Get the current application statistics' do
......
......@@ -8,9 +8,6 @@
"snippets",
"ssh_keys",
"milestones",
"users",
"projects",
"groups",
"active_users"
],
"properties" : {
......@@ -21,9 +18,6 @@
"snippets'": { "type": "string" },
"ssh_keys'": { "type": "string" },
"milestones'": { "type": "string" },
"users'": { "type": "string" },
"projects'": { "type": "string" },
"groups'": { "type": "string" },
"active_users'": { "type": "string" }
}
}
# frozen_string_literal: true
require 'spec_helper'
describe API::Statistics, 'Statistics' do
......@@ -36,7 +38,6 @@ describe API::Statistics, 'Statistics' do
projects = create_list(:project, 4, namespace: create(:namespace, owner: admin))
issues = create_list(:issue, 2, project: projects.first, updated_by: admin)
create_list(:group, 2)
create_list(:snippet, 2, :public, author: admin)
create_list(:note, 2, author: admin, project: projects.first, noteable: issues.first)
create_list(:milestone, 3, project: projects.first)
......@@ -52,9 +53,6 @@ describe API::Statistics, 'Statistics' do
expect(json_response['forks']).to eq('0')
expect(json_response['ssh_keys']).to eq('1')
expect(json_response['milestones']).to eq('3')
expect(json_response['users']).to eq('1')
expect(json_response['projects']).to eq('4')
expect(json_response['groups']).to eq('2')
expect(json_response['active_users']).to eq('1')
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment