Commit 8f642cb79b0520e2a36fc22641d669c376a8fb0e
Committed by
Paulo Meireles
1 parent
8f41190e
Exists in
master
and in
29 other branches
[Mezuro] Now partial shows a table with the history a chosen metric's results.
Showing
3 changed files
with
18 additions
and
4 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
... | ... | @@ -128,9 +128,10 @@ class MezuroPluginProfileController < ProfileController |
128 | 128 | metric_name = params[:metric_name] |
129 | 129 | content = profile.articles.find(params[:id]) |
130 | 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 | 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 | 135 | end |
135 | 136 | |
136 | 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 | 32 | <%= range.nil? or range.comments.nil? ? 'comment empty' : range.comments %> |
33 | 33 | </td> |
34 | 34 | <td> |
35 | + <td colspan="4"> | |
35 | 36 | <div id='historical-<%= metric_result.metric.name.delete("() ") %>'> |
36 | 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 | 38 | </div> | ... | ... |