From bbf808b4c61e9a1c94168ef3cf78fd86b37867ba Mon Sep 17 00:00:00 2001 From: Joao M. M. da Silva + Jefferson Fernandes Date: Fri, 18 May 2012 14:20:52 -0300 Subject: [PATCH] [Mezuro] Draft to Google Charts implementation in show_history --- plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb | 8 +++----- plugins/mezuro/views/content_viewer/_score_history.rhtml | 13 +++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb index 71f5cfe..6a8e59d 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb @@ -28,7 +28,7 @@ class MezuroPluginProfileController < ProfileController date = params[:date] date.nil? ? content.project_result : content.get_date_result(date) module_result = content.module_result(params[:module_name]) - render :partial => 'content_viewer/module_result', :locals => { :module_result => module_result} + render :partial => 'content_viewer/module_result', :locals => { :module_result => module_result} end def project_tree @@ -43,16 +43,14 @@ class MezuroPluginProfileController < ProfileController metric_name = params[:metric_name] content = profile.articles.find(params[:id]) module_history = content.result_history(params[:module_name]) - date_history = module_history.collect { |module_result| module_result.date } score_history = (module_history.collect { |module_result| (module_result.metric_results.select { |metric_result| metric_result.metric.name.delete("() ") == metric_name })[0] }).collect { |metric_result| metric_result.value } - render :partial => 'content_viewer/score_history', :locals => {:score_history => score_history, :date_history => date_history } + render :partial => 'content_viewer/score_history', :locals => {:score_history => score_history} end def module_grade_history content = profile.articles.find(params[:id]) modules_results = content.result_history(params[:module_name]) - date_history = modules_results.collect { |module_result| module_result.date } score_history = modules_results.collect { |module_result| module_result.grade } - render :partial => 'content_viewer/score_history', :locals => {:date_history => date_history, :score_history => score_history } + render :partial => 'content_viewer/score_history', :locals => {:score_history => score_history} end end diff --git a/plugins/mezuro/views/content_viewer/_score_history.rhtml b/plugins/mezuro/views/content_viewer/_score_history.rhtml index c6cf73a..27581c1 100644 --- a/plugins/mezuro/views/content_viewer/_score_history.rhtml +++ b/plugins/mezuro/views/content_viewer/_score_history.rhtml @@ -1,10 +1,3 @@ - - <% cont = 0 %> - <% date_history.each do |date| %> - - - - - <% cont = cont + 1 %> - <% end %> -
<%= date %> <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(score_history[cont]) %>
+ +
<%= MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(score_history) %>
+ -- libgit2 0.21.2