Commit 88bbff0210da75e55da43c47eda5561e64037426
Committed by
João M. M. da Silva
1 parent
5f82a4d1
Exists in
master
and in
28 other branches
[Mezuro] Finished source tree view.
Showing
4 changed files
with
11 additions
and
7 deletions
Show diff stats
plugins/mezuro/lib/kalibro/module_result.rb
... | ... | @@ -7,7 +7,7 @@ class Kalibro::ModuleResult < Kalibro::Model |
7 | 7 | end |
8 | 8 | |
9 | 9 | def children |
10 | - response = self.class.request(:children_of, {:module_result_id => self.id})[:module_result] | |
10 | + response = self.class.request(:children_of, {:module_result_id => id})[:module_result] | |
11 | 11 | response = [] if response.nil? |
12 | 12 | response = [response] if response.is_a?(Hash) |
13 | 13 | response.map {|module_result| Kalibro::ModuleResult.new module_result} | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
... | ... | @@ -20,10 +20,15 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase |
20 | 20 | end |
21 | 21 | |
22 | 22 | should 'find module result on kalibro' do |
23 | + parent_module_result = ModuleResultFixtures.parent_module_result_hash | |
23 | 24 | Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:id] }). |
24 | 25 | returns({:module_result => @module_result_hash}) |
25 | 26 | Kalibro::MetricResult.expects(:request).with(:metric_results_of, { :module_result_id => @module_result_hash[:id] }). |
26 | 27 | returns({:metric_result => @metric_result_hash}) |
28 | + Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:parent_id] }). | |
29 | + returns({:module_result => parent_module_result}) | |
30 | + Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result_hash[:id]}). | |
31 | + returns({:module_result => nil}) | |
27 | 32 | get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] |
28 | 33 | assert_equal @module_result_hash[:grade], assigns(:module_result).grade |
29 | 34 | assert_equal @metric_result_hash[:value], assigns(:metric_results).first.value | ... | ... |
plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | <div id='historical-grade' style="display: none;"></div> |
12 | 12 | </td> |
13 | 13 | <td align = "right"> |
14 | - <a href="#" show-grade-history="<%= @module_result.id %>" data-module-id="<%= module_result.id %>" > | |
14 | + <a href="#" show-grade-history="<%= @module_result.id %>" data-module-id="<%= @module_result.id %>" > | |
15 | 15 | <strong> |
16 | 16 | <%= _('Grade:') %> |
17 | 17 | <%= "%.02f" % @module_result.grade %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_module_result/_source_tree.rhtml
1 | 1 | <h4><%= _('Source tree') %></h4> |
2 | -<% module_name = @module_result.module.name %> | |
3 | -<% module_label = "#{module_name} (#{@module_result.module.granularity})" %> | |
2 | +<% module_name = module_result.module.name %> | |
3 | +<% module_label = "#{module_name} (#{module_result.module.granularity})" %> | |
4 | 4 | |
5 | 5 | <p> |
6 | 6 | <h2 class="path"> |
7 | - <% parents = @module_result.parents %> | |
8 | - <% parents.each do |parent| %> | |
7 | + <% module_result.parents.each do |parent| %> | |
9 | 8 | /<a href="#" class="source-tree-link" data-module-id="<%= parent.id %>"> |
10 | 9 | <%= parent.module.name %> |
11 | 10 | </a> |
... | ... | @@ -14,7 +13,7 @@ |
14 | 13 | </p> |
15 | 14 | |
16 | 15 | <table border="0" class="source-tree"> |
17 | - <% @module_result.children.each do |child| %> | |
16 | + <% module_result.children.each do |child| %> | |
18 | 17 | <% if child.module.granularity=='PACKAGE' %> |
19 | 18 | <tr> |
20 | 19 | <td class="icon"><%= image_tag('/plugins/mezuro/images/folder.png')%></td> | ... | ... |