internetee-registry/app/jobs/delete_monthly_invoices_job.rb
Sergei Tsõganov 72022aab8d Refactored code
2022-08-22 10:23:14 +03:00

10 lines
319 B
Ruby

class DeleteMonthlyInvoicesJob < ApplicationJob
queue_as :default
def perform
@month = Time.zone.now - 1.month
invoices = Invoice.where(monthly_invoice: true, issue_date: @month.end_of_month.to_date,
in_directo: false, e_invoice_sent_at: nil)
invoices.delete_all
end
end