From: Simon Brandhof Date: Thu, 13 Jun 2013 17:20:55 +0000 (+0200) Subject: SONAR-4395 The SQL request used to get hotspot on metric can be improved X-Git-Tag: 3.7~486 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=951325a821d32fc2396461231b467d560b632fb6;p=sonarqube.git SONAR-4395 The SQL request used to get hotspot on metric can be improved --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb index 09a42b4d6bd..103b9ac8bad 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_metric.html.erb @@ -11,8 +11,7 @@ if metric.numeric? && !@snapshot.leaves_qualifiers.empty? snapshots_conditions=["snapshots.qualifier in (:qualifiers)", "snapshots.islast=:islast", "snapshots.status = 'P'"] snapshots_values={:qualifiers => @snapshot.leaves_qualifiers, :islast => true} - snapshots_conditions << '(snapshots.id=:sid OR (snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path))' - snapshots_values[:sid]=@snapshot.id + snapshots_conditions << '(snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path)' snapshots_values[:root_sid] = (@snapshot.root_snapshot_id || @snapshot.id) snapshots_values[:path]="#{@snapshot.path}#{@snapshot.id}.%" diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_resources.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_resources.html.erb index a26c9e73eca..af7aaf65adf 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_resources.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_resources.html.erb @@ -4,8 +4,7 @@ snapshots_conditions=["snapshots.qualifier in (:qualifiers)", "snapshots.islast=:islast", "snapshots.status = 'P'"] snapshots_values={:qualifiers => @snapshot.leaves_qualifiers, :islast => true} - snapshots_conditions << '(snapshots.id=:sid OR (snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path))' - snapshots_values[:sid]=@snapshot.id + snapshots_conditions << '(snapshots.root_snapshot_id=:root_sid AND snapshots.path LIKE :path)' snapshots_values[:root_sid] = (@snapshot.root_snapshot_id || @snapshot.id) snapshots_values[:path]="#{@snapshot.path}#{@snapshot.id}.%"