Commit 7c9e82fa authored by Robert Speicher's avatar Robert Speicher

Merge branch 'issue_220867' into 'master'

Count health status only for opened issues

See merge request gitlab-org/gitlab!36359
parents f21a90f7 40f95322
...@@ -59,7 +59,10 @@ module Epics ...@@ -59,7 +59,10 @@ module Epics
def issue_health_statuses def issue_health_statuses
strong_memoize(:issue_health_statuses) do strong_memoize(:issue_health_statuses) do
Issue.in_epics(accessible_epics).counts_by_health_status Issue.in_epics(accessible_epics)
.opened
.with_health_status
.counts_by_health_status
end end
end end
......
---
title: Count health status only for opened issues
merge_request: 36359
author:
type: changed
...@@ -14,9 +14,10 @@ RSpec.describe Epics::DescendantCountService do ...@@ -14,9 +14,10 @@ RSpec.describe Epics::DescendantCountService do
let_it_be(:issue1) { create(:issue, project: project, state: :opened, health_status: :on_track) } let_it_be(:issue1) { create(:issue, project: project, state: :opened, health_status: :on_track) }
let_it_be(:issue2) { create(:issue, project: project, state: :closed, health_status: :on_track) } let_it_be(:issue2) { create(:issue, project: project, state: :closed, health_status: :on_track) }
let_it_be(:issue3) { create(:issue, project: project, state: :opened) } let_it_be(:issue3) { create(:issue, project: project, state: :opened) }
let_it_be(:issue4) { create(:issue, project: project, state: :closed, health_status: :needs_attention) } let_it_be(:issue4) { create(:issue, project: project, state: :opened, health_status: :needs_attention) }
let_it_be(:issue5) { create(:issue, :confidential, project: project, state: :opened, health_status: :at_risk) } let_it_be(:issue5) { create(:issue, project: project, state: :closed, health_status: :needs_attention) }
let_it_be(:issue6) { create(:issue, :confidential, project: project, state: :closed, health_status: :at_risk) } let_it_be(:issue6) { create(:issue, :confidential, project: project, state: :opened, health_status: :at_risk) }
let_it_be(:issue7) { create(:issue, :confidential, project: project, state: :closed, health_status: :at_risk) }
let_it_be(:epic_issue1) { create(:epic_issue, epic: parent_epic, issue: issue1) } let_it_be(:epic_issue1) { create(:epic_issue, epic: parent_epic, issue: issue1) }
let_it_be(:epic_issue2) { create(:epic_issue, epic: parent_epic, issue: issue2) } let_it_be(:epic_issue2) { create(:epic_issue, epic: parent_epic, issue: issue2) }
...@@ -24,6 +25,7 @@ RSpec.describe Epics::DescendantCountService do ...@@ -24,6 +25,7 @@ RSpec.describe Epics::DescendantCountService do
let_it_be(:epic_issue4) { create(:epic_issue, epic: epic2, issue: issue4) } let_it_be(:epic_issue4) { create(:epic_issue, epic: epic2, issue: issue4) }
let_it_be(:epic_issue5) { create(:epic_issue, epic: epic1, issue: issue5) } let_it_be(:epic_issue5) { create(:epic_issue, epic: epic1, issue: issue5) }
let_it_be(:epic_issue6) { create(:epic_issue, epic: epic2, issue: issue6) } let_it_be(:epic_issue6) { create(:epic_issue, epic: epic2, issue: issue6) }
let_it_be(:epic_issue6) { create(:epic_issue, epic: epic2, issue: issue7) }
subject { described_class.new(parent_epic, user) } subject { described_class.new(parent_epic, user) }
...@@ -46,7 +48,7 @@ RSpec.describe Epics::DescendantCountService do ...@@ -46,7 +48,7 @@ RSpec.describe Epics::DescendantCountService do
end end
describe '#opened_issues' do describe '#opened_issues' do
it_behaves_like 'descendants state count', :opened_issues, 3 it_behaves_like 'descendants state count', :opened_issues, 4
end end
describe '#closed_issues' do describe '#closed_issues' do
...@@ -54,7 +56,7 @@ RSpec.describe Epics::DescendantCountService do ...@@ -54,7 +56,7 @@ RSpec.describe Epics::DescendantCountService do
end end
describe '#issues_on_track' do describe '#issues_on_track' do
it_behaves_like 'descendants state count', :issues_on_track, 2 it_behaves_like 'descendants state count', :issues_on_track, 1
end end
describe '#issues_needing_attention' do describe '#issues_needing_attention' do
...@@ -62,6 +64,6 @@ RSpec.describe Epics::DescendantCountService do ...@@ -62,6 +64,6 @@ RSpec.describe Epics::DescendantCountService do
end end
describe '#issues_at_risk' do describe '#issues_at_risk' do
it_behaves_like 'descendants state count', :issues_at_risk, 2 it_behaves_like 'descendants state count', :issues_at_risk, 1
end end
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