Commit e67c922df0692ef31a809d06f5ff26d0729ab038

Authored by Rafael Manzo
1 parent 07f196bf

[Mezuro] Fixed metric result view

plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb
... ... @@ -7,7 +7,7 @@ class MezuroPluginModuleResultController < MezuroPluginProfileController
7 7 @metric_results = Kalibro::MetricResult.metric_results_of(@module_result.id)
8 8 render :partial => 'module_result'
9 9 end
10   -
  10 +
11 11 def metric_result_history
12 12 @history = Kalibro::MetricResult.history_of(params[:metric_name], params[:module_result_id].to_i)
13 13 render :partial => 'score_history'
... ...
plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml
... ... @@ -9,28 +9,32 @@
9 9 <tbody>
10 10 <% @metric_results.each do |metric_result| %>
11 11 <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%>
12   - <% range_snapshot = metric_configuration_snapshot.range_snapshot %>
  12 + <% range_snapshots = metric_configuration_snapshot.range_snapshot %>
13 13 <% formatted_name = MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_configuration_snapshot) %>
14   - <% if !range_snapshot.nil? %>
  14 + <% if !range_snapshots.nil? %>
15 15 <tr>
16 16 <td style="width: 74%"><a href="#" show-metric-history="<%= formatted_name %>" data-module-id="<%= @module_result_id %>"><%= metric_configuration_snapshot.metric.name %></a></td>
17 17 <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td>
18 18 <td><%= metric_configuration_snapshot.weight %></td>
19   - <td style="background-color: #<%= range_snapshot.color %>">
20   - <span title="<%= range_snapshot.comments %>" >
21   - <%= range_snapshot.label %>
  19 + <% range_snapshots.each do |range_snapshot| %>
  20 + <% if range_snapshot[:beginning].to_f <= metric_result.value and range_snapshot[:end].to_f > metric_result.value %>
  21 + <td style="background-color: #<%= range_snapshot[:color] %>">
  22 + <span title="<%= range_snapshot[:comments] %>" >
  23 + <%= range_snapshot[:label] %>
22 24 </span>
23 25 </td>
24   - </tr>
  26 + </tr>
25 27 <tr class="<%= formatted_name %>" style="display: none;">
26 28 <td colspan="3">
27 29 <div id='historical-<%= formatted_name %>'>
28 30 </div>
29 31 </td>
30 32 <td align="right">
31   - <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %>
32   - </td>
  33 + <%= range_snapshot[:comments].nil? ? '' : range_snapshot[:comments] %>
  34 + </td>
33 35 </tr>
  36 + <% end %>
  37 + <% end %>
34 38 <% end %>
35 39 <% end %>
36 40 </tbody>
... ...