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 4e066c4..fbbe087 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb @@ -26,7 +26,8 @@ class MezuroPluginProfileController < ProfileController def module_result content = profile.articles.find(params[:id]) date = params[:date] - module_result = content.module_result(params[:module_name], date) + project_result = 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} end @@ -38,4 +39,13 @@ class MezuroPluginProfileController < ProfileController 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/test/functional/mezuro_plugin_profile_controller_test.rb b/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb index c895bde..44e42cd 100644 --- a/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb +++ b/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb @@ -64,11 +64,11 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase should 'get project results from a specific date' do create_project_content - client = mock - Kalibro::Client::ProjectResultClient.expects(:new).returns(client) - client.expects(:has_results_before).returns(true) - client.expects(:last_result_before).returns(@project_result) - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => "2012-04-13T20:39:41+04:00" + client = mock + Kalibro::Client::ProjectResultClient.expects(:new).returns(client) + client.expects(:has_results_before).returns(true) + client.expects(:last_result_before).returns(@project_result) + get :project_result, :profile => @profile.identifier, :id => @content.id, :date => "2012-04-13T20:39:41+04:00" assert_response 200 end -- libgit2 0.21.2