Class: UpdatedInventory

Inherits:
ApplicationRecord show all
Defined in:
app/models/updated_inventory.rb

Overview

typed: ignore frozen_string_literal: true

Class Method Summary collapse

Methods inherited from ApplicationRecord

sync_carrierwave_url

Class Method Details

.dup_inventory(inventory) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/updated_inventory.rb', line 12

def self.dup_inventory(inventory)
  attribute_param = {
    start_date: inventory.date,
    end_date: inventory.date,
    start_time: inventory.start_time,
    end_time: inventory.end_time,
    quantity_available: inventory.quantity_available,
    restaurant_id: inventory.restaurant_id,
    reason: '',
    service_type: inventory.class.to_s == 'Inventory' ? 'dine_in' : 'take_away'
  }
  HH_LOGGER.info('inventory:duplicate_inventory', attribute_param)
  if create attribute_param
    true
  else
    APMErrorHandler.report 'Failed to log modified inventory', attribute_param
    false
  end
end