Commit 808fe996aee6a8f5098cccffe1e18f5fc8a20363

Authored by Carlos Morais + Paulo Meirelles
Committed by Paulo Meireles
1 parent a7d753dc

Showing metric results for root module

plugins/mezuro/lib/kalibro/entities/metric_result.rb
... ... @@ -5,7 +5,7 @@ class Kalibro::Entities::MetricResult < Kalibro::Entities::Entity
5 5 def metric=(value)
6 6 if value.kind_of?(Hash)
7 7 @metric = to_entity(value, Kalibro::Entities::CompoundMetric) if value.has_key?(:script)
8   - @metric = to_entity(value, Kalibro::Entities::NativeMetric) if value.has_key?(:origin)
  8 + @metric = to_entity(value, Kalibro::Entities::NativeMetric)
9 9 else
10 10 @metric = value
11 11 end
... ...
plugins/mezuro/views/content_viewer/show_project.rhtml
... ... @@ -49,6 +49,8 @@
49 49 <% elsif @project.state == 'READY' %>
50 50 <h3><%= _('LAST RESULT') %></h3>
51 51 <% @project_result = Kalibro::Client::ProjectResultClient.new.last_result(@project.name) %>
  52 + <% @module_client = Kalibro::Client::ModuleResultClient.new %>
  53 +
52 54 <table id="project_result_info">
53 55 <tr>
54 56 <td><%= _('Date') %></td>
... ... @@ -65,4 +67,28 @@
65 67 </table>
66 68 <h5><%= _('Source tree') %></h5>
67 69 <%= @project_result.source_tree.print %>
  70 +
  71 + <% @module_result = @module_client.module_result(@project.name, @project.name, @project_result.date) %>
  72 +
  73 + <h5><%= _('Metric Result') %> </h5>
  74 + <strong>
  75 + <%= _('Module:') %>
  76 + <%= @module_result.module.name %>
  77 + <br/>
  78 + <%= _('Grade:') %>
  79 + <%= @module_result.grade %>
  80 + </strong>
  81 + <br/>
  82 + <hr/>
  83 + <table id="project_metric_result">
  84 + <% @module_result.metric_results.each do |metric_result| %>
  85 + <tr>
  86 + <td><%= metric_result.metric.name %></td>
  87 + <td><%= metric_result.value %></td>
  88 + <td><%= metric_result.range.label %></td>
  89 + </tr>
  90 +
  91 + <% end %>
  92 + </table>
  93 +
68 94 <% end %>
... ...