Class: RetailerComplianceReportWorker

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

Overview

Scheduled: daily per-retailer compliance digest (MAP violations, listing
errors, out-of-stock, etc.) emailed to cbillen@warmlyyours.com, ~6 AM CT after
retailer_probe_worker (see sidekiq_production_schedule.yml).

Also persists each retailer's counts to catalog_data_points so the /retailers
dashboards can show trends — every metric is a point-in-time count that can't
be reconstructed retroactively, so history accrues from here forward. The same
report instance feeds both the snapshot and the email so they always agree.

Instance Method Summary collapse

Instance Method Details

#performObject

Runs the job.

Returns:

  • (Object)

    the result



17
18
19
20
21
# File 'app/workers/retailer_compliance_report_worker.rb', line 17

def perform
  report = Retailer::DailyComplianceReport.for_scheduled_run
  record_data_points(report)
  InternalReportsMailer.retailer_compliance_report(report:).deliver_now
end