Created
August 4, 2011 13:14
-
-
Save Electron-libre/1125122 to your computer and use it in GitHub Desktop.
Script reversement v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accounts = Account.where(:ss7 => true).map { |a| [a.customer, a.code] } | |
report = [] | |
accounts.each do |account| | |
account_report = [] | |
account_count = [] | |
Journal.where('account' => account[1], 'date' => /2011-07/).each do |journal| | |
account_report << journal.billing_entries.sum(:duration) | |
account_count << journal.billing_entries.where(:duration.gt => 0.0).count | |
end | |
report << [account[0], account[1], account_report.compact.sum, account_count.sum] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment