Patch #27676 » 0003-Performance-opt-cache-AR-Proxy-for-Version-fixed_iss.patch
app/helpers/versions_helper.rb | ||
---|---|---|
57 | 57 |
h = Hash.new {|k,v| k[v] = [0, 0]} |
58 | 58 |
begin |
59 | 59 |
# Total issue count |
60 |
version.fixed_issues.visible.group(criteria).count.each {|c,s| h[c][0] = s}
|
|
60 |
version.visible_fixed_issues.group(criteria).count.each {|c,s| h[c][0] = s}
|
|
61 | 61 |
# Open issues count |
62 |
version.fixed_issues.visible.open.group(criteria).count.each {|c,s| h[c][1] = s}
|
|
62 |
version.visible_fixed_issues.open.group(criteria).count.each {|c,s| h[c][1] = s}
|
|
63 | 63 |
rescue ActiveRecord::RecordNotFound |
64 | 64 |
# When grouping by an association, Rails throws this exception if there's no result (bug) |
65 | 65 |
end |
app/models/version.rb | ||
---|---|---|
176 | 176 |
alias :base_reload :reload |
177 | 177 |
def reload(*args) |
178 | 178 |
@default_project_version = nil |
179 |
@visible_fixed_issues = nil |
|
179 | 180 |
base_reload(*args) |
180 | 181 |
end |
181 | 182 | |
... | ... | |
257 | 258 |
fixed_issues.closed_count |
258 | 259 |
end |
259 | 260 | |
261 |
def visible_fixed_issues |
|
262 |
@visible_fixed_issues ||= fixed_issues.visible |
|
263 |
end |
|
264 | ||
260 | 265 |
def wiki_page |
261 | 266 |
if project.wiki && !wiki_page_title.blank? |
262 | 267 |
@wiki_page ||= project.wiki.find_page(wiki_page_title) |
app/views/versions/_overview.html.erb | ||
---|---|---|
14 | 14 |
</ul> |
15 | 15 |
<% end %> |
16 | 16 | |
17 |
<% if version.fixed_issues.visible.count > 0 %>
|
|
18 |
<%= progress_bar([version.fixed_issues.visible.closed_percent, version.fixed_issues.visible.completed_percent],
|
|
17 |
<% if version.visible_fixed_issues.count > 0 %>
|
|
18 |
<%= progress_bar([version.visible_fixed_issues.closed_percent, version.visible_fixed_issues.completed_percent],
|
|
19 | 19 |
:titles => |
20 |
["%s: %0.0f%%" % [l(:label_closed_issues_plural), version.fixed_issues.visible.closed_percent],
|
|
21 |
"%s: %0.0f%%" % [l(:field_done_ratio), version.fixed_issues.visible.completed_percent]],
|
|
22 |
:legend => ('%0.0f%%' % version.fixed_issues.visible.completed_percent)) %>
|
|
20 |
["%s: %0.0f%%" % [l(:label_closed_issues_plural), version.visible_fixed_issues.closed_percent],
|
|
21 |
"%s: %0.0f%%" % [l(:field_done_ratio), version.visible_fixed_issues.completed_percent]],
|
|
22 |
:legend => ('%0.0f%%' % version.visible_fixed_issues.completed_percent)) %>
|
|
23 | 23 |
<p class="progress-info"> |
24 |
<%= link_to(l(:label_x_issues, :count => version.fixed_issues.visible.count),
|
|
24 |
<%= link_to(l(:label_x_issues, :count => version.visible_fixed_issues.count),
|
|
25 | 25 |
version_filtered_issues_path(version, :status_id => '*')) %> |
26 | 26 |
|
27 |
(<%= link_to_if(version.fixed_issues.visible.closed_count > 0,
|
|
28 |
l(:label_x_closed_issues_abbr, :count => version.fixed_issues.visible.closed_count),
|
|
27 |
(<%= link_to_if(version.visible_fixed_issues.closed_count > 0,
|
|
28 |
l(:label_x_closed_issues_abbr, :count => version.visible_fixed_issues.closed_count),
|
|
29 | 29 |
version_filtered_issues_path(version, :status_id => 'c')) %> |
30 | 30 |
— |
31 |
<%= link_to_if(version.fixed_issues.visible.open_count > 0,
|
|
32 |
l(:label_x_open_issues_abbr, :count => version.fixed_issues.visible.open_count),
|
|
31 |
<%= link_to_if(version.visible_fixed_issues.open_count > 0,
|
|
32 |
l(:label_x_open_issues_abbr, :count => version.visible_fixed_issues.open_count),
|
|
33 | 33 |
version_filtered_issues_path(version, :status_id => 'o')) %>) |
34 | 34 |
</p> |
35 | 35 |
<% else %> |
app/views/versions/show.html.erb | ||
---|---|---|
12 | 12 |
<%= render(:partial => "wiki/content", :locals => {:content => @version.wiki_page.content}) if @version.wiki_page %> |
13 | 13 | |
14 | 14 |
<div id="version-summary"> |
15 |
<% if @version.fixed_issues.visible.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %>
|
|
15 |
<% if @version.visible_fixed_issues.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %>
|
|
16 | 16 |
<fieldset class="time-tracking"><legend><%= l(:label_time_tracking) %></legend> |
17 | 17 |
<table> |
18 | 18 |
<tr> |
19 | 19 |
<th><%= l(:field_estimated_hours) %></th> |
20 |
<td class="total-hours"><%= link_to html_hours(l_hours(@version.fixed_issues.visible.estimated_hours)),
|
|
20 |
<td class="total-hours"><%= link_to html_hours(l_hours(@version.visible_fixed_issues.estimated_hours)),
|
|
21 | 21 |
project_issues_path(@version.project, :set_filter => 1, :status_id => '*', :fixed_version_id => @version.id, :c => [:tracker, :status, :subject, :estimated_hours], :t => [:estimated_hours]) %></td> |
22 | 22 |
</tr> |
23 | 23 |
<% if User.current.allowed_to_view_all_time_entries?(@project) %> |