seed generator

This commit is contained in:
Zoey
2019-06-18 13:35:15 +06:30
parent a0506f5a4e
commit 61166d615d
21 changed files with 139 additions and 37 deletions

View File

@@ -18,7 +18,7 @@ class Booking < ApplicationRecord
booking = TableBooking.new
booking.booking_id = b['booking_id']
booking.dining_facility_id = b['dining_facility_id']
booking.type = b['type']
# booking.type = b['type']
booking.checkin_at = b['checkin_at']
booking.checkin_by = b['checkin_by']
booking.checkout_at = b['checkout_at']
@@ -97,7 +97,7 @@ class Booking < ApplicationRecord
.joins('left join sale_orders on sale_orders.order_id=assigned_order_items.order_id')
.where('sale_orders.sale_id=?', sale_id)
@bookings = Booking.where('sale_id=?', sale_id)
@bookings = TableBooking.where('sale_id=?', sale_id)
@sales = Sale.where("sale_id=?", sale_id)
@@ -120,6 +120,11 @@ class Booking < ApplicationRecord
private
def generate_custom_id
self.booking_id = SeedGenerator.generate_id(self.class.name, "BKI")
prefix = "BKI"
if ENV["SERVER_MODE"] == 'cloud'
prefix = "CBKI"
end
self.booking_id = SeedGenerator.generate_id(self.class.name, prefix)
end
end