Browse Source

shorten long line of ReportsHelper

git-svn-id: http://svn.redmine.org/redmine/trunk@20139 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.2.0
Toshi MARUYAMA 3 years ago
parent
commit
00e52fb9de
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      app/helpers/reports_helper.rb

+ 9
- 5
app/helpers/reports_helper.rb View File

@@ -21,13 +21,17 @@ module ReportsHelper

def aggregate(data, criteria)
a = 0
data.each { |row|
data.each do |row|
match = 1
criteria.each { |k, v|
match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
} unless criteria.nil?
criteria.each do |k, v|
unless (row[k].to_s == v.to_s) ||
(k == 'closed' &&
(v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
match = 0
end
end unless criteria.nil?
a = a + row["total"].to_i if match == 1
} unless data.nil?
end unless data.nil?
a
end


Loading…
Cancel
Save