Add rake task to import bank_transactions

This commit is contained in:
Patrick Gansterer 2017-01-17 23:12:31 +01:00
parent d4ab0a055f
commit 9fc51bdce8
2 changed files with 16 additions and 0 deletions

View file

@ -63,6 +63,17 @@ namespace :foodsoft do
server.start
server.join
end
desc "Import and assign bank transactions"
task :import_and_assign_bank_transactions => :environment do
BankAccount.find_each do |ba|
import_method = ba.find_import_method
next unless import_method
import_count = import_method.call(ba)
assign_count = ba.assign_unlinked_transactions
rake_say "#{ba.name}: imported #{import_count}, assigned #{assign_count}"
end
end
end
# Helper