Commit 8f642cb79b0520e2a36fc22641d669c376a8fb0e

Authored by Renan Teruoc + Diego Araujo
Committed by Paulo Meireles
1 parent 8f41190e

[Mezuro] Now partial shows a table with the history a chosen metric's results.

plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
@@ -128,9 +128,10 @@ class MezuroPluginProfileController < ProfileController @@ -128,9 +128,10 @@ class MezuroPluginProfileController < ProfileController
128 metric_name = params[:metric_name] 128 metric_name = params[:metric_name]
129 content = profile.articles.find(params[:id]) 129 content = profile.articles.find(params[:id])
130 module_history = content.result_history(params[:module_name]) 130 module_history = content.result_history(params[:module_name])
131 - metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name == metric_name })[0] } 131 + date_history = module_history.collect { |x| x.date }
  132 + metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] }
132 #precisamos que uma variável receba um array com os valores da métrica passada a partir do result history 133 #precisamos que uma variável receba um array com os valores da métrica passada a partir do result history
133 - render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history } 134 +render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history }
134 end 135 end
135 136
136 end 137 end
plugins/mezuro/views/content_viewer/_metric_history.rhtml
1 -<br>  
2 -<h5> TESTANDO </h5> 1 +<table width="100%">
  2 + <tr>
  3 + <% date_history.each do |date| %>
  4 + <td> <b> <%= date %> </b> </td>
  5 + <% end %>
  6 + </tr>
  7 + <tr>
  8 + <% metric_history.each do |metric_result| %>
  9 + <td>
  10 + <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %>
  11 + </td>
  12 + <% end %>
  13 + </tr>
  14 + </table>
plugins/mezuro/views/content_viewer/_module_result.rhtml
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 <%= range.nil? or range.comments.nil? ? 'comment empty' : range.comments %> 32 <%= range.nil? or range.comments.nil? ? 'comment empty' : range.comments %>
33 </td> 33 </td>
34 <td> 34 <td>
  35 + <td colspan="4">
35 <div id='historical-<%= metric_result.metric.name.delete("() ") %>'> 36 <div id='historical-<%= metric_result.metric.name.delete("() ") %>'>
36 <a href="#" show-metric-history="<%= metric_result.metric.name.delete("() ") %>" data-module-name="<%= the_module.name %>" data-metric-name="<%= metric_result.metric.name.delete("() ") %>"> <p style="text-indent: 3em;"> Draw Historical Graphic </p> </a> 37 <a href="#" show-metric-history="<%= metric_result.metric.name.delete("() ") %>" data-module-name="<%= the_module.name %>" data-metric-name="<%= metric_result.metric.name.delete("() ") %>"> <p style="text-indent: 3em;"> Draw Historical Graphic </p> </a>
37 </div> 38 </div>