From 06d09a45ec152093238bd0324cb2f7ff019baf0f Mon Sep 17 00:00:00 2001 From: Diego Araújo + Paulo Meirelles Date: Thu, 26 Apr 2012 16:39:07 -0300 Subject: [PATCH] [Mezuro] Changed the table for metric history --- plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb | 8 -------- plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb | 10 +++++++++- plugins/mezuro/views/content_viewer/_metric_history.rhtml | 20 ++++++++------------ 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb b/plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb index 1b470c8..47427c0 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb @@ -99,14 +99,6 @@ class MezuroPluginMyprofileController < ProfileController redirect_to "/#{profile.identifier}/#{configuration_name.downcase.gsub(/\s/, '-')}" end - def module_metrics_history - metric_name = params[:metric_name] - content = profile.articles.find(params[:id]) - module_history = content.result_history(params[:module_name]) - date_history = module_history.collect { |x| x.date } - metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] } - render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history } - end private def new_metric_configuration_instance diff --git a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb index 1adb57b..e51fa22 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb @@ -40,5 +40,13 @@ class MezuroPluginProfileController < ProfileController source_tree = project_result.node_of(params[:module_name]) render :partial =>'content_viewer/source_tree', :locals => { :source_tree => source_tree, :project_name => content.project.name} end - + + def module_metrics_history + metric_name = params[:metric_name] + content = profile.articles.find(params[:id]) + module_history = content.result_history(params[:module_name]) + date_history = module_history.collect { |x| x.date } + metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] } + render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history } + end end diff --git a/plugins/mezuro/views/content_viewer/_metric_history.rhtml b/plugins/mezuro/views/content_viewer/_metric_history.rhtml index 4293aff..9e155a3 100644 --- a/plugins/mezuro/views/content_viewer/_metric_history.rhtml +++ b/plugins/mezuro/views/content_viewer/_metric_history.rhtml @@ -1,14 +1,10 @@ - - <% date_history.each do |date| %> - - <% end %> - - - <% metric_history.each do |metric_result| %> - - <% end %> - + <% cont = 0 %> + <% date_history.each do |date| %> + + + + + <% cont = cont + 1 %> + <% end %>
<%= date %>
- <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %> -
<%= date %> <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_history[cont].value) %>
-- libgit2 0.21.2