Commit fb294f212db7e33aecc45d81cf3e81e7f0a389ee

Authored by Rafael Manzo
1 parent bbf75a42

Better cache fragment keys and chart labels

app/views/modules/_metric_results.html.erb
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 </thead> 7 </thead>
8 8
9 <tbody> 9 <tbody>
10 - <% cache do %> 10 + <% cache("#{@root_module_result.id}_results") do %>
11 <%= render partial: 'metric_result', collection: @root_module_result.metric_results, locals: {module_result: @root_module_result} %> 11 <%= render partial: 'metric_result', collection: @root_module_result.metric_results, locals: {module_result: @root_module_result} %>
12 <% end %> 12 <% end %>
13 </tbody> 13 </tbody>
app/views/modules/_module_tree.html.erb
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <p id="parent"><i class="icon-arrow-up"></i><%= link_to '../', '#parent', onClick: "Module.Tree.load('#{escape_javascript(image_tag 'loader.gif')} Loading data. Please, wait.', #{@root_module_result.parent_id});" %></p> 14 <p id="parent"><i class="icon-arrow-up"></i><%= link_to '../', '#parent', onClick: "Module.Tree.load('#{escape_javascript(image_tag 'loader.gif')} Loading data. Please, wait.', #{@root_module_result.parent_id});" %></p>
15 <% end %> 15 <% end %>
16 16
17 -<% cache do %> 17 +<% cache("#{@root_module_result.id}_tree") do %>
18 <% children = @root_module_result.children %> 18 <% children = @root_module_result.children %>
19 <% unless children.empty? %> 19 <% unless children.empty? %>
20 <table class="table table-hover"> 20 <table class="table table-hover">
app/views/modules/metric_history.js.erb
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 var values = []; 5 var values = [];
6 6
7 <% metric_history.keys.each do |date| %> 7 <% metric_history.keys.each do |date| %>
8 - dates.push("<%= date %>"); 8 + dates.push("<%= date.to_s[0,10] %>");
9 values.push(<%= metric_history[date] %>); 9 values.push(<%= metric_history[date] %>);
10 <% end %> 10 <% end %>
11 11