aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-07-27 10:59:00 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-07-27 12:12:01 +0200
commit58a8a74c05def9176479b2cf951c49f398cb72f8 (patch)
tree336eabec56e974a6668c3547c1ee64c12dca5a66 /sonar-server/src
parentea0fb362a7dd6188973c0cb27291720ae71c29ca (diff)
downloadsonarqube-58a8a74c05def9176479b2cf951c49f398cb72f8.tar.gz
sonarqube-58a8a74c05def9176479b2cf951c49f398cb72f8.zip
SONAR-2648 New web service /api/manual_measures
Diffstat (limited to 'sonar-server/src')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb
index 7be0373987b..704058273fe 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb
@@ -40,7 +40,7 @@ class Api::ManualMeasuresController < Api::ApiController
end
respond_to do |format|
- format.json { render :json => jsonp(manual_measures_to_json(result)) }
+ format.json { render :json => jsonp(manual_measures_to_json(resource, result)) }
format.xml { render :xml => xml_not_supported }
end
end
@@ -69,7 +69,7 @@ class Api::ManualMeasuresController < Api::ApiController
measure.save!
respond_to do |format|
- format.json { render :json => jsonp(manual_measure_to_json(measure)) }
+ format.json { render :json => jsonp(manual_measure_to_json(resource, measure)) }
format.xml { render :xml => xml_not_supported }
end
end
@@ -91,16 +91,16 @@ class Api::ManualMeasuresController < Api::ApiController
private
- def manual_measures_to_json(manual_measures)
+ def manual_measures_to_json(resource, manual_measures)
json = []
manual_measures.each do |m|
- json<<manual_measure_to_json(m)
+ json<<manual_measure_to_json(resource, m)
end
json
end
- def manual_measure_to_json(manual_measure)
- hash={:id => manual_measure.id, :metric => manual_measure.metric.key}
+ def manual_measure_to_json(resource, manual_measure)
+ hash={:id => manual_measure.id, :metric => manual_measure.metric.key, :resource => resource.key}
hash[:val]=manual_measure.value if manual_measure.value
hash[:text]=manual_measure.text_value if manual_measure.text_value
hash[:desc]=manual_measure.description if manual_measure.description