Class: ScheduleWorkers::DeactivateRestaurantTest

Inherits:
ApplicationWorker show all
Defined in:
app/workers/schedule_workers/deactivate_restaurant_test.rb

Overview

typed: true

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#performObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/workers/schedule_workers/deactivate_restaurant_test.rb', line 4

def perform
  if IS_STAGING_ENV
    Rails.logger.info('Skipping Firebase certificate update in non-production environment')
    return
  end

  ids = AdminSetting.restaurant_ids_for_testing.to_s.split(',').map(&:strip).map(&:to_i)
  return if ids.blank?

  restaurants = Restaurant.where(id: ids)
  restaurants.each do |restaurant|
    restaurant.update! active: false if restaurant&.active?
  end
end