Class: CreditMemoUpdateReportGroupingWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/credit_memo_update_report_grouping_worker.rb

Overview

Backfill worker that fills in the report_grouping column on legacy
CreditMemos using Customer::ReportGrouping so the BoB report can
bucket them consistently with newer rows.

Instance Method Summary collapse

Instance Method Details

#performvoid

This method returns an undefined value.

Walks report_grouping IS NULL memos and writes the customer's
current report grouping in place via update_columns (skipping
validations and timestamps).



13
14
15
16
17
# File 'app/workers/credit_memo_update_report_grouping_worker.rb', line 13

def perform
  CreditMemo.where(report_grouping: nil).find_each do |cm|
    cm.update_columns(report_grouping: Customer::ReportGrouping.get_report_grouping_for_customer(cm.customer)) if cm.customer.present?
  end
end