Skip to content

Commit

Permalink
updated condition for rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Hasjanov authored and Oleg Hasjanov committed Jan 22, 2024
1 parent 1d38a01 commit daf8bfb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tasks/assign_invoices_vat_rate.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace :invoices do
desc 'Assign vat rate to invoices what have vat rate of nil'
task assign_invoices_vat_rate: :environment do
Invoice.where(vat_rate: nil, country_code: 'EE', vat_code: nil).in_batches do |batch_invoices|
Invoice.where(vat_rate: [nil, 0.0], country_code: 'EE', vat_code: [nil, '']).in_batches do |batch_invoices|
batch_invoices.where('created_at < ?', '2024-01-01').update_all(vat_rate: 0.2)
batch_invoices.where('created_at >= ?', '2024-01-01').update_all(vat_rate: 0.22)
end
Expand Down

0 comments on commit daf8bfb

Please sign in to comment.