Commit 16b1512e authored by Sean McGivern's avatar Sean McGivern

Merge branch 'reduce-queries-milestone-index' into 'master'

Use cached values to compute total issues count in milestone index pages

See merge request !8518
parents fbc1a06c b11492c2
......@@ -7,11 +7,14 @@ module Milestoneish
def total_items_count(user)
memoize_per_user(user, :total_items_count) do
issues_count = count_issues_by_state(user).values.sum
issues_count + merge_requests.size
total_issues_count(user) + merge_requests.size
end
end
def total_issues_count(user)
count_issues_by_state(user).values.sum
end
def complete?(user)
total_items_count(user) > 0 && total_items_count(user) == closed_items_count(user)
end
......
......@@ -9,7 +9,7 @@
.pull-right.light #{milestone.percent_complete(current_user)}% complete
.row
.col-sm-6
= link_to pluralize(milestone.issues_visible_to_user(current_user).size, 'Issue'), issues_path
= link_to pluralize(milestone.total_issues_count(current_user), 'Issue'), issues_path
·
= link_to pluralize(milestone.merge_requests.size, 'Merge Request'), merge_requests_path
.col-sm-6= milestone_progress_bar(milestone)
......
---
title: Use cached values to compute total issues count in milestone index pages
merge_request: 8518
author:
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