update add extra time after request

This commit is contained in:
Aung Myo
2018-01-03 10:01:43 +06:30
parent e27b468db1
commit 7ece8cbb47
2 changed files with 10 additions and 8 deletions

View File

@@ -27,8 +27,10 @@ class Order < ApplicationRecord
if self.new_booking
#add extra time
if self.is_extra_time && self.extra_time
old_booking = Booking.where("booking_id = #{self.booking_id} and sale_id NOT NULL").first
new_time = old_booking.checkout_at + self.extra_time.to_i
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
:checkin_at => Time.now.utc,:checkout_at => new_time,
:checkin_by => self.employee_name,
:booking_status => "assign" })
else
@@ -37,7 +39,6 @@ class Order < ApplicationRecord
:booking_status => "assign" })
end
#end extra time
table = DiningFacility.find(self.table_id)
table.status = "occupied"