Commit 0e8e78ac authored by Arturo Herrero's avatar Arturo Herrero

Remove count_by from UsageData#count

This change was introduced in dd85269a but it hasn't been used.
parent b5d8f44b
...@@ -228,8 +228,8 @@ module Gitlab ...@@ -228,8 +228,8 @@ module Gitlab
{} # augmented in EE {} # augmented in EE
end end
def count(relation, count_by: nil, fallback: -1) def count(relation, fallback: -1)
count_by ? relation.count(count_by) : relation.count relation.count
rescue ActiveRecord::StatementInvalid rescue ActiveRecord::StatementInvalid
fallback fallback
end end
......
...@@ -339,12 +339,6 @@ describe Gitlab::UsageData do ...@@ -339,12 +339,6 @@ describe Gitlab::UsageData do
expect(described_class.count(relation)).to eq(1) expect(described_class.count(relation)).to eq(1)
end end
it 'returns the count for count_by when provided' do
allow(relation).to receive(:count).with(:creator_id).and_return(2)
expect(described_class.count(relation, count_by: :creator_id)).to eq(2)
end
it 'returns the fallback value when counting fails' do it 'returns the fallback value when counting fails' do
allow(relation).to receive(:count).and_raise(ActiveRecord::StatementInvalid.new('')) allow(relation).to receive(:count).and_raise(ActiveRecord::StatementInvalid.new(''))
......
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