diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:49 +0300 |
commit | 77237c5a6b9044f58beabc54d3589e5fa09cbfba (patch) | |
tree | f43188047fe8955f6cf78e05ae9c2e8f6a019e0b /app/models/concerns/milestoneish.rb | |
parent | 2fd92f2dc784ade9cb4e1c33dd60cbfad7b86818 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/milestoneish.rb')
-rw-r--r-- | app/models/concerns/milestoneish.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/app/models/concerns/milestoneish.rb b/app/models/concerns/milestoneish.rb index 88e752e51e7..045e893761a 100644 --- a/app/models/concerns/milestoneish.rb +++ b/app/models/concerns/milestoneish.rb @@ -2,13 +2,27 @@ module Milestoneish def total_issues_count(user) - count_issues_by_state(user).values.sum + @total_issues_count ||= + if Feature.enabled?(:cached_milestone_issue_counters) + Milestones::IssuesCountService.new(self).count + else + count_issues_by_state(user).values.sum + end end def closed_issues_count(user) - closed_state_id = Issue.available_states[:closed] + @close_issues_count ||= + if Feature.enabled?(:cached_milestone_issue_counters) + Milestones::ClosedIssuesCountService.new(self).count + else + closed_state_id = Issue.available_states[:closed] + + count_issues_by_state(user)[closed_state_id].to_i + end + end - count_issues_by_state(user)[closed_state_id].to_i + def opened_issues_count(user) + total_issues_count(user) - closed_issues_count(user) end def complete?(user) |