]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2073 fix selection of metrics in filter treemaps
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 12 Jun 2012 12:51:06 +0000 (14:51 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 12 Jun 2012 12:51:06 +0000 (14:51 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb

index eda7f53536b5a1dc02d63032f2bf538a7a0a789f..46ec74f4e8c57e3a2439882cdaf80f671cd8d9f4 100644 (file)
@@ -37,7 +37,8 @@ class TreemapController < ApplicationController
     size_metric=Metric.by_key(params[:size_metric]||'lines')
     bad_request('Unknown metric: ' + params[:size_metric]) unless size_metric
 
-    color_metric=(params[:color_metric].present? ? Metric.by_key(params[:color_metric]) : nil)
+    color_metric=Metric.by_key(params[:color_metric])
+    bad_request('Unknown metric: ' + params[:color_metric]) unless color_metric
 
     if params[:resource]
       resource = Project.by_key(params[:resource])
@@ -51,6 +52,7 @@ class TreemapController < ApplicationController
       bad_request('Unknown filter: ' + params[:filter]) unless filter
       access_denied unless filter.authorized_to_execute?(self)
       filter.sorted_column=FilterColumn.new('family' => 'metric', :kee => size_metric.key, :sort_direction => (size_metric.direction>=0 ? 'ASC' : 'DESC'))
+      params[:metric_ids]=[size_metric.id, color_metric.id]
       filter_context=Filters.execute(filter, self, params)
     else
       bad_request('Missing parameter: resource or filter')