Commit 980c97e7 authored by Eugenia Grieff's avatar Eugenia Grieff

Apply review suggestions

parent 1881821d
......@@ -25,12 +25,6 @@ module EE
blocked_or_blocking_issuables(issuable.id).pluck(:source_id)
end
def blocked_or_blocking_issuables(issuables_ids)
where(link_type: ::IssueLink::TYPE_BLOCKS).where(target_id: issuables_ids)
.joins(:source)
.where(source: { state_id: ::Issuable::STATE_ID_MAP[:opened] })
end
def blocking_issuables_for_collection(issuables_ids)
open_state_id = ::Issuable::STATE_ID_MAP[:opened]
grouping_row_name = "blocking_#{issuable_type}_id"
......@@ -57,6 +51,14 @@ module EE
def blocking_issuables_count_for(issue)
blocking_issuables_for_collection(issue.id)[0]&.count.to_i
end
private
def blocked_or_blocking_issuables(issuables_ids)
where(link_type: ::IssuableLink::TYPE_BLOCKS).where(target_id: issuables_ids)
.joins(:source)
.where(source: { state_id: ::Issuable::STATE_ID_MAP[:opened] })
end
end
end
end
......@@ -13,14 +13,6 @@ RSpec.shared_examples 'issuables that can block or be blocked' do
end
end
describe '.inverse_link_type' do
it 'returns the inverse type of link' do
expect(described_class.inverse_link_type('relates_to')).to eq('relates_to')
expect(described_class.inverse_link_type('is_blocked_by')).to eq('is_blocked_by')
expect(described_class.inverse_link_type('blocks')).to eq('is_blocked_by')
end
end
describe '.blocked_issuable_ids' do
it 'returns only ids of issues which are blocked' do
link1 = create(factory_class, link_type: ::IssuableLink::TYPE_BLOCKS)
......@@ -43,13 +35,6 @@ RSpec.shared_examples 'issuables that can block or be blocked' do
end
end
describe '.inverse_link_type' do
it 'returns reverse type of link' do
expect(described_class.inverse_link_type('relates_to')).to eq 'relates_to'
expect(described_class.inverse_link_type('blocks')).to eq 'is_blocked_by'
end
end
context 'blocking issuables count' do
before :all do
create(factory_class, source: blocking_issuable_1, target: blocked_issuable_1, link_type: ::IssuableLink::TYPE_BLOCKS)
......
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