query_report 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,8 @@ module QueryReport
44
44
  end
45
45
 
46
46
  class Column
47
+ include ActionView::Helpers::SanitizeHelper
48
+
47
49
  attr_reader :report, :name, :options, :type, :data
48
50
 
49
51
  def initialize(report, column_name, options={}, block = nil)
@@ -90,8 +92,19 @@ module QueryReport
90
92
  end
91
93
 
92
94
  def total
93
- @total ||= has_total? ? report.records_with_rowspan.inject(0) { |sum, r| sum + report.content_from_element(r[humanize]).to_f } : nil
95
+ @total ||= begin
96
+ if has_total?
97
+ report.records_with_rowspan.inject(0) do |sum, r|
98
+ r = report.content_from_element(r[humanize])
99
+ r = strip_tags(r) if r.kind_of? String
100
+ sum + r.to_f
101
+ end
102
+ else
103
+ nil
104
+ end
105
+ end
94
106
  end
107
+
95
108
  end
96
109
  end
97
110
  end
@@ -1,3 +1,3 @@
1
1
  module QueryReport
2
- VERSION = "1.0.17"
2
+ VERSION = "1.0.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-11 00:00:00.000000000 Z
12
+ date: 2013-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails