mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Merge branch 'story/105852786-directo' into staging
This commit is contained in:
commit
3bcc2e8796
1 changed files with 4 additions and 3 deletions
|
@ -3,8 +3,9 @@ class Directo < ActiveRecord::Base
|
|||
|
||||
def self.send_receipts
|
||||
new_trans = Invoice.where(invoice_type: "DEB", in_directo: false).where(cancelled_at: nil)
|
||||
counter = 0
|
||||
Rails.logger.info("[DIRECTO] Will try to send #{new_trans.count} invoices")
|
||||
total = new_trans.count
|
||||
counter = 0
|
||||
Rails.logger.info("[DIRECTO] Will try to send #{total} invoices")
|
||||
|
||||
new_trans.find_in_batches(batch_size: 10).each do |group|
|
||||
mappers = {} # need them as no direct connection between invoice
|
||||
|
@ -45,7 +46,7 @@ class Directo < ActiveRecord::Base
|
|||
dump_result_to_db(mappers, response)
|
||||
end
|
||||
|
||||
STDOUT << "Directo receipts sending finished. #{counter} of #{new_trans.count} are sent"
|
||||
STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n"
|
||||
end
|
||||
|
||||
def self.dump_result_to_db mappers, xml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue