From e67c922df0692ef31a809d06f5ff26d0729ab038 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Tue, 18 Dec 2012 17:52:21 -0200 Subject: [PATCH] [Mezuro] Fixed metric result view --- plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb | 2 +- plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb index e28aa92..15bc6a5 100644 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb +++ b/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb @@ -7,7 +7,7 @@ class MezuroPluginModuleResultController < MezuroPluginProfileController @metric_results = Kalibro::MetricResult.metric_results_of(@module_result.id) render :partial => 'module_result' end - + def metric_result_history @history = Kalibro::MetricResult.history_of(params[:metric_name], params[:module_result_id].to_i) render :partial => 'score_history' diff --git a/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml b/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml index 41e2410..a89039d 100644 --- a/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml +++ b/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml @@ -9,28 +9,32 @@ <% @metric_results.each do |metric_result| %> <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%> - <% range_snapshot = metric_configuration_snapshot.range_snapshot %> + <% range_snapshots = metric_configuration_snapshot.range_snapshot %> <% formatted_name = MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_configuration_snapshot) %> - <% if !range_snapshot.nil? %> + <% if !range_snapshots.nil? %> <%= metric_configuration_snapshot.metric.name %> <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %> <%= metric_configuration_snapshot.weight %> - - - <%= range_snapshot.label %> + <% range_snapshots.each do |range_snapshot| %> + <% if range_snapshot[:beginning].to_f <= metric_result.value and range_snapshot[:end].to_f > metric_result.value %> + + + <%= range_snapshot[:label] %> - +
- <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %> - + <%= range_snapshot[:comments].nil? ? '' : range_snapshot[:comments] %> + + <% end %> + <% end %> <% end %> <% end %> -- libgit2 0.21.2