]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3838 The widget "Most violated resources" generates an exception when used...
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 9 Oct 2012 14:08:41 +0000 (16:08 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 9 Oct 2012 14:10:48 +0000 (16:10 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_resources.html.erb

index c3cde4869f1c2d6e3ff39603134ef2cc1f0e48fd..c377a0cdd9c74f815c46ef643256d59e0c120fcc 100644 (file)
@@ -9,7 +9,7 @@
    snapshots_values[:root_sid] = (@snapshot.root_snapshot_id || @snapshot.id)
    snapshots_values[:path]="#{@snapshot.path}#{@snapshot.id}.%"
 
-   measures_conditions = ["project_measures.rule_id IS NULL", "project_measures.characteristic_id IS NULL", "project_measures.person_id IS NULL"]
+   measures_conditions = ["project_measures.rule_id IS NULL AND project_measures.characteristic_id IS NULL AND project_measures.person_id IS NULL"]
    measures_values = {}
    measures_conditions << "project_measures.metric_id = :m_id"
    measures_values[:m_id] = metric.id
@@ -19,6 +19,7 @@
                                 :conditions => [(snapshots_conditions + measures_conditions).join(' AND '), snapshots_values.merge(measures_values)],
                                 :order => "project_measures.value #{'DESC' if metric.direction<0}",
                                 :limit => limit)
+   measures=measures.select{|m| m.text_value.present?}
 
    snapshots=Snapshot.find(measures.map { |m| m.snapshot_id }, :include => 'project')
    snapshots_by_id = {}