Created
April 14, 2011 08:42
-
-
Save Electron-libre/919135 to your computer and use it in GitHub Desktop.
How I tried to fix it
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 = %w( 0990000047000 0990000047001 0990000047900 ) | |
("0990000091000" .. "0990000091005").each do |c| | |
accounts << c | |
end | |
("0990000071000" .. "0990000071019").each do |c| | |
accounts << c | |
end | |
date = '10-11' | |
def reprice(accounts,date) | |
accounts.each do |acc| | |
Mongoid.database['journals'].find({'account' => acc, 'date' => Regexp.new("^#{date}")}, :timeout => false ) do |query_cursor| | |
Mongoid::Cursor.new(Journal,Journal,query_cursor).each do |j| | |
j.billing_entries.each do |entry| | |
cdr = Cdr.where(:icid => entry.icid).first | |
destination = Destination.resolve(cdr) | |
price_hash = Pricer::Calculator.get_price(cdr, destination) | |
entry.update_attributes({:destination => destination.label}.merge(price_hash)) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment