update extra time

This commit is contained in:
Aung Myo
2018-01-03 10:12:22 +06:30
parent 76c72d8f54
commit c8b7417f6a
2 changed files with 8 additions and 10 deletions

View File

@@ -27,10 +27,8 @@ 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 => new_time,
:checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i,
:checkin_by => self.employee_name,
:booking_status => "assign" })
else
@@ -39,6 +37,7 @@ class Order < ApplicationRecord
:booking_status => "assign" })
end
#end extra time
table = DiningFacility.find(self.table_id)
table.status = "occupied"