We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05c532b commit 00e52fbCopy full SHA for 00e52fb
app/helpers/reports_helper.rb
@@ -21,13 +21,17 @@ module ReportsHelper
21
22
def aggregate(data, criteria)
23
a = 0
24
- data.each { |row|
+ data.each do |row|
25
match = 1
26
- criteria.each { |k, v|
27
- match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
28
- } unless criteria.nil?
+ criteria.each do |k, v|
+ unless (row[k].to_s == v.to_s) ||
+ (k == 'closed' &&
29
+ (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
30
+ match = 0
31
+ end
32
+ end unless criteria.nil?
33
a = a + row["total"].to_i if match == 1
- } unless data.nil?
34
+ end unless data.nil?
35
a
36
end
37
0 commit comments