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 6ea4e28..e28aa92 100644
--- a/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb
+++ b/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb
@@ -4,15 +4,10 @@ class MezuroPluginModuleResultController < MezuroPluginProfileController
def module_result
@module_result = Kalibro::ModuleResult.find(params[:module_result_id].to_i)
+ @metric_results = Kalibro::MetricResult.metric_results_of(@module_result.id)
render :partial => 'module_result'
end
- def metric_results
- @module_result_id = params[:module_result_id].to_i
- @metric_results = Kalibro::MetricResult.metric_results_of(@module_result_id)
- render :partial => 'metric_results'
- 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/lib/kalibro/date_metric_result.rb b/plugins/mezuro/lib/kalibro/date_metric_result.rb
index 2254c32..5e79a89 100644
--- a/plugins/mezuro/lib/kalibro/date_metric_result.rb
+++ b/plugins/mezuro/lib/kalibro/date_metric_result.rb
@@ -9,5 +9,8 @@ class Kalibro::DateMetricResult < Kalibro::Model
def metric_result=(value)
@metric_result = Kalibro::MetricResult.to_object value
end
-
+
+ def result
+ @metric_result.value
+ end
end
diff --git a/plugins/mezuro/lib/kalibro/date_module_result.rb b/plugins/mezuro/lib/kalibro/date_module_result.rb
index 09a66da..241e7f6 100644
--- a/plugins/mezuro/lib/kalibro/date_module_result.rb
+++ b/plugins/mezuro/lib/kalibro/date_module_result.rb
@@ -10,4 +10,8 @@ class Kalibro::DateModuleResult < Kalibro::Model
@module_result = Kalibro::ModuleResult.to_object value
end
+ def result
+ @module_result.grade
+ end
+
end
diff --git a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
index 0ed41b3..feab0f9 100644
--- a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
+++ b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
@@ -26,8 +26,8 @@ class MezuroPlugin::Helpers::ContentViewerHelper
values = []
labels = []
score_history.each do |score_data|
- values << score_data.first
- labels << score_data.last
+ values << score_data.result
+ labels << score_data.date
end
labels = discretize_array labels
Gchart.line(
diff --git a/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb b/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb
index 832643e..8494fe1 100644
--- a/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb
+++ b/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb
@@ -14,7 +14,7 @@ class MetricConfigurationSnapshotFixtures
:aggregation_form => 'AVERAGE',
:metric => MetricFixtures.amloc_hash,
:base_tool_name => "Analizo",
- :range => [RangeSnapshotFixtures.range_snapshot_hash],
+ :range => RangeSnapshotFixtures.range_snapshot_hash,
:attributes! => {
:metric => {
'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',
@@ -34,7 +34,7 @@ class MetricConfigurationSnapshotFixtures
:aggregation_form => 'AVERAGE',
:metric => MetricFixtures.compound_metric,
:base_tool_name => "Analizo",
- :range => [RangeSnapshotFixtures.range_snapshot_hash],
+ :range => RangeSnapshotFixtures.range_snapshot_hash,
:attributes! => {
:metric => {
'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',
diff --git a/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb b/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
index a545a38..cec91e7 100644
--- a/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
+++ b/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
@@ -22,18 +22,11 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase
should 'find module result on kalibro' do
Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:id] }).
returns({:module_result => @module_result_hash})
- get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id]
- assert_equal @module_result_hash[:grade], assigns(:module_result).grade
- assert_response 200
- #TODO assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)')
- end
-
- should 'get metric_results' do
Kalibro::MetricResult.expects(:request).with(:metric_results_of, { :module_result_id => @module_result_hash[:id] }).
returns({:metric_result => @metric_result_hash})
- get :metric_results, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id]
+ get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id]
+ assert_equal @module_result_hash[:grade], assigns(:module_result).grade
assert_equal @metric_result_hash[:value], assigns(:metric_results).first.value
- assert_equal @module_result_hash[:id], assigns(:module_result_id)
assert_response 200
#TODO assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)')
end
@@ -43,7 +36,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase
Kalibro::MetricResult.expects(:request).with(:history_of, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id] }).
returns({:date_metric_result => @date_metric_result_hash})
get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name
- assert_equal @date_metric_result_hash[:date], assigns(:date_metric_results).first.date
+ assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date
assert_response 200
#TODO assert_select
end
@@ -52,7 +45,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase
Kalibro::ModuleResult.expects(:request).with(:history_of_module, { :module_result_id => @module_result_hash[:id] }).
returns({:date_module_result => @date_module_result_hash})
get :module_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id]
- assert_equal @date_module_result_hash[:date], assigns(:date_module_results).first.date
+ assert_equal DateTime.parse(@date_module_result_hash[:date]), assigns(:history).first.date
assert_response 200
#TODO assert_select
end
diff --git a/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml b/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml
new file mode 100644
index 0000000..41e2410
--- /dev/null
+++ b/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml
@@ -0,0 +1,36 @@
+
+
+
+
+Metric
+ Value
+ Weight
+ Threshold
+