Class: PrintAllChecksWorker
- Inherits:
-
Object
- Object
- PrintAllChecksWorker
- Includes:
- Sidekiq::Job, Workers::StatusBroadcastable
- Defined in:
- app/workers/print_all_checks_worker.rb
Overview
Sidekiq worker: print all checks.
Instance Attribute Summary
Attributes included from Workers::StatusBroadcastable
Instance Method Summary collapse
Methods included from Workers::StatusBroadcastable::Overrides
Instance Method Details
#perform(options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/workers/print_all_checks_worker.rb', line 10 def perform() current_user = Party.find(['current_user_id']) total ['payment_ids'].size regenerate_pdf = ['regenerate_pdf'].to_b num = 0 pdfs = [] ['payment_ids'].each do |payment_id| at(num, "Processing payment id #{payment_id}") payment = OutgoingPayment.find(payment_id) pdfs << payment.print_check(current_user, regenerate_pdf: regenerate_pdf) num += 1 end pdf = PdfTools.combine(pdfs, output_file_path: Upload.temp_location("combined_check_printout_#{Time.current.to_fs(:no_spaces)}.pdf")) upload = Upload.uploadify(pdf, 'check') store upload_id: upload.id end |