Add rake task to import bank_transactions
This commit is contained in:
parent
d4ab0a055f
commit
9fc51bdce8
2 changed files with 16 additions and 0 deletions
|
@ -7,6 +7,11 @@ every :day, :at => '7:20 am' do
|
|||
rake "multicoops:run TASK=foodsoft:notify_users_of_weekly_task"
|
||||
end
|
||||
|
||||
# Import and assign bank transactions
|
||||
every :weekday, :at => %w(5:56am 6:04pm) do
|
||||
rake "multicoops:run TASK=foodsoft:import_and_assign_bank_transactions"
|
||||
end
|
||||
|
||||
# Weekly taks
|
||||
every :sunday, :at => '7:14 am' do
|
||||
rake "multicoops:run TASK=foodsoft:create_upcoming_periodic_tasks"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue