Class: AwaitingQualityControlPlansWorker

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

Overview

Sidekiq worker: awaiting quality control plans.

Instance Method Summary collapse

Instance Method Details

#perform(overnight = false) ⇒ Object

Biz time is defined per thread so we have to use a global var

overnight: true (the 7:29am schedule entry) skips the business-hours
guard — that run exists precisely to report what accumulated while the
hourly runs were suppressed overnight.



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

def perform(overnight = false)
  return unless overnight || Time.current.in_working_hours? # Only run during business hours.

  rcs = RoomConfiguration.where(state: 'awaiting_quality_control').where('updated_at < (?)', 15.minutes.ago)
  TrainingMailer.plans_ready_to_be_relased(rcs, overnight: overnight).deliver_now if rcs.present?
end