before sync
This commit is contained in:
@@ -14,24 +14,26 @@ class Booking < ApplicationRecord
|
||||
def self.sync_booking_records(bookings)
|
||||
if !bookings.nil?
|
||||
bookings.each do |b|
|
||||
unless TableBooking.exists?(b['booking_id'])
|
||||
booking = TableBooking.find_by_booking_id(b['booking_id'])
|
||||
# unless TableBooking.exists?(b['booking_id'])
|
||||
if booking.nil?
|
||||
booking = TableBooking.new
|
||||
booking.booking_id = b['booking_id']
|
||||
booking.dining_facility_id = b['dining_facility_id']
|
||||
# booking.type = b['type']
|
||||
booking.checkin_at = b['checkin_at']
|
||||
booking.checkin_by = b['checkin_by']
|
||||
booking.checkout_at = b['checkout_at']
|
||||
booking.checkout_by = b['checkout_by']
|
||||
booking.reserved_at = b['reserved_at']
|
||||
booking.reserved_by = b['reserved_by']
|
||||
booking.booking_status = b['booking_status']
|
||||
booking.sale_id = b['sale_id']
|
||||
booking.customer_id = b['customer_id']
|
||||
booking.save
|
||||
puts '....... Booking has been created ......'
|
||||
end
|
||||
booking.booking_id = b['booking_id']
|
||||
booking.dining_facility_id = b['dining_facility_id']
|
||||
# booking.type = b['type']
|
||||
booking.checkin_at = b['checkin_at']
|
||||
booking.checkin_by = b['checkin_by']
|
||||
booking.checkout_at = b['checkout_at']
|
||||
booking.checkout_by = b['checkout_by']
|
||||
booking.reserved_at = b['reserved_at']
|
||||
booking.reserved_by = b['reserved_by']
|
||||
booking.booking_status = b['booking_status']
|
||||
booking.sale_id = b['sale_id']
|
||||
booking.customer_id = b['customer_id']
|
||||
booking.save
|
||||
end
|
||||
puts '....... Booking sync completed ......'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user