]> source.dussan.org Git - sonarqube.git/commitdiff
Fix 2 issues on drilldown pages
authorsimonbrandhof <simon.brandhof@gmail.com>
Thu, 5 May 2011 19:50:53 +0000 (21:50 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Thu, 5 May 2011 19:50:53 +0000 (21:50 +0200)
SONAR-2411 Filter out best values for packages and modules in drilldown
SONAR-2413 Empty variations in measure drilldown pages

sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb

index 62148d4e8bd40e0aa6ed3a5ac105b9d7dfd9d3d9..dc527ee5340d11703f39980ad2e314928374ea38 100644 (file)
@@ -61,12 +61,7 @@ class DrilldownColumn
       order += ' DESC'
     end
 
-    conditions='snapshots.root_snapshot_id=:root_sid AND snapshots.islast=:islast AND snapshots.scope=:scope AND snapshots.path LIKE :path AND project_measures.metric_id=:metric_id'
-
-    if options[:exclude_zero_value]
-      conditions += " AND project_measures.#{value_column}<>0"
-    end
-
+    conditions="snapshots.root_snapshot_id=:root_sid AND snapshots.islast=:islast AND snapshots.scope=:scope AND snapshots.path LIKE :path AND project_measures.metric_id=:metric_id AND project_measures.#{value_column} IS NOT NULL"
     condition_values={
       :root_sid => (snapshot.root_snapshot_id || snapshot.id),
       :islast=>true,
@@ -74,6 +69,15 @@ class DrilldownColumn
       :metric_id=>metric.id,
       :path => "#{snapshot.path}#{snapshot.id}.%"}
 
+    if value_column=='value' && metric.best_value
+      conditions<<' AND project_measures.value<>:best_value'
+      condition_values[:best_value]=metric.best_value
+    end
+
+    if options[:exclude_zero_value]
+      conditions += " AND project_measures.#{value_column}<>0"
+    end
+
     if options[:rule_id]
       conditions += ' AND project_measures.rule_id=:rule'
       condition_values[:rule]=options[:rule_id]