Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-06-22 09:53:04 +06:30
17 changed files with 280 additions and 56 deletions

View File

@@ -19,11 +19,10 @@ class DiningFacility < ApplicationRecord
end
def get_current_booking
puts "enter booking"
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
if booking.count > 0 then
return booking[0].booking_id
return booking[0]
else
return nil
end

View File

@@ -4,7 +4,7 @@ class Order < ApplicationRecord
#primary key - need to be unique
before_create :generate_custom_id
before_create :set_order_date
has_many :sale_orders
belongs_to :customer
has_many :order_items, autosave: true , inverse_of: :order
has_many :assigned_order_items