mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
parent
942ac47b00
commit
a0aac379b6
4 changed files with 8 additions and 57 deletions
|
@ -1,16 +0,0 @@
|
|||
namespace :data_migrations do
|
||||
task populate_invoice_vat_rate: :environment do
|
||||
processed_invoice_count = 0
|
||||
|
||||
Invoice.transaction do
|
||||
Invoice.where(vat_rate: nil).find_each do |invoice|
|
||||
vat_rate = Invoice::VatRateCalculator.new(registrar: invoice.buyer).calculate
|
||||
invoice.update!(vat_rate: vat_rate)
|
||||
|
||||
processed_invoice_count += 1
|
||||
end
|
||||
end
|
||||
|
||||
puts "Invoices processed: #{processed_invoice_count}"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue