Class: OutletPurchaseDigestWorker

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

Overview

Daily digest of new outlet-purchase matches to orders@, cc'ing the named
reviewers.

Runs after OutletPurchaseMatchWorker so the sweep's proposals are in the
window. Sends nothing on a day with no matches — a digest that arrives every
morning saying "0" trains people to ignore it, and the volume here is roughly
90 a year.

See Also:

Instance Method Summary collapse

Instance Method Details

#perform(hours = 24) ⇒ void

This method returns an undefined value.

Parameters:

  • hours (Integer) (defaults to: 24)

    window to report on; matches the daily cadence



20
21
22
23
24
25
# File 'app/workers/outlet_purchase_digest_worker.rb', line 20

def perform(hours = 24)
  since = hours.to_i.hours.ago
  return if CustomerOutletPurchaseQuery.new.created_since(since).relation.none?

  InternalReportsMailer.outlet_purchase_digest(since: since).deliver_now
end