Commit 06d09a45ec152093238bd0324cb2f7ff019baf0f
Committed by
Paulo Meireles
1 parent
ad1a898d
Exists in
master
and in
29 other branches
[Mezuro] Changed the table for metric history
Showing
3 changed files
with
17 additions
and
21 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
@@ -99,14 +99,6 @@ class MezuroPluginMyprofileController < ProfileController | @@ -99,14 +99,6 @@ class MezuroPluginMyprofileController < ProfileController | ||
99 | redirect_to "/#{profile.identifier}/#{configuration_name.downcase.gsub(/\s/, '-')}" | 99 | redirect_to "/#{profile.identifier}/#{configuration_name.downcase.gsub(/\s/, '-')}" |
100 | end | 100 | end |
101 | 101 | ||
102 | - def module_metrics_history | ||
103 | - metric_name = params[:metric_name] | ||
104 | - content = profile.articles.find(params[:id]) | ||
105 | - module_history = content.result_history(params[:module_name]) | ||
106 | - date_history = module_history.collect { |x| x.date } | ||
107 | - metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] } | ||
108 | - render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history } | ||
109 | - end | ||
110 | private | 102 | private |
111 | 103 | ||
112 | def new_metric_configuration_instance | 104 | def new_metric_configuration_instance |
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
@@ -40,5 +40,13 @@ class MezuroPluginProfileController < ProfileController | @@ -40,5 +40,13 @@ class MezuroPluginProfileController < ProfileController | ||
40 | source_tree = project_result.node_of(params[:module_name]) | 40 | source_tree = project_result.node_of(params[:module_name]) |
41 | render :partial =>'content_viewer/source_tree', :locals => { :source_tree => source_tree, :project_name => content.project.name} | 41 | render :partial =>'content_viewer/source_tree', :locals => { :source_tree => source_tree, :project_name => content.project.name} |
42 | end | 42 | end |
43 | - | 43 | + |
44 | + def module_metrics_history | ||
45 | + metric_name = params[:metric_name] | ||
46 | + content = profile.articles.find(params[:id]) | ||
47 | + module_history = content.result_history(params[:module_name]) | ||
48 | + date_history = module_history.collect { |x| x.date } | ||
49 | + metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] } | ||
50 | + render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history } | ||
51 | + end | ||
44 | end | 52 | end |
plugins/mezuro/views/content_viewer/_metric_history.rhtml
1 | <table width="100%"> | 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> | 2 | + <% cont = 0 %> |
3 | + <% date_history.each do |date| %> | ||
4 | + <tr> | ||
5 | + <td width="70%"> <b> <%= date %> </b> </td> | ||
6 | + <td width="30%"> <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_history[cont].value) %> </td> | ||
7 | + </tr> | ||
8 | + <% cont = cont + 1 %> | ||
9 | + <% end %> | ||
14 | </table> | 10 | </table> |