Class: ActivityProductionCheckJob

Inherits:
ScheduleJob
  • Object
show all
Defined in:
app/jobs/activity_production_check_job.rb

Instance Method Summary collapse

Methods inherited from ScheduleJob

#perform, #perform_on_each_tenant

Instance Method Details

#perform_on_tenantObject


4
5
6
7
8
9
10
11
# File 'app/jobs/activity_production_check_job.rb', line 4

def perform_on_tenant
  today = Date.today
  if ActivityProduction.where(started_on: today).any?
    Ekylibre::Hook.publish(:activity_production_start)
  elsif ActivityProduction.where(stopped_on: today - 1).any?
    Ekylibre::Hook.publish(:activity_production_stop)
  end
end