Class: InventoryReservationWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- InventoryReservationWorker
- Includes:
- ElasticAPM::SpanHelpers
- Defined in:
- app/workers/inventory_reservation_worker.rb
Overview
This worker responsible to update total booked seat on Inventory table Based on how many seats taken by checking Reservation table
Instance Method Summary collapse
-
#perform(restaurant_id, start_date, end_date) ⇒ Object
Updates inventory booked seat counts for a restaurant within a date range.
Methods inherited from ApplicationWorker
Instance Method Details
#perform(restaurant_id, start_date, end_date) ⇒ Object
Updates inventory booked seat counts for a restaurant within a date range
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/workers/inventory_reservation_worker.rb', line 14 def perform(restaurant_id, start_date, end_date) batch_size = AdminSetting.inventory_reservation_import_batch_size.to_i restaurant = Restaurant.fetch(restaurant_id) # Process reservations and generate inventory reservation data reservation_data = process_reservations(restaurant, start_date, end_date) # Update inventory reservations and total booked seats update_dine_in_inventories(reservation_data[:dine_in], restaurant, start_date, end_date, batch_size) update_delivery_inventories(reservation_data[:delivery], restaurant, start_date, end_date, batch_size) end |