fixed conflict

This commit is contained in:
Nweni
2017-06-06 09:43:16 +06:30
50 changed files with 331 additions and 106 deletions

View File

@@ -1,6 +1,8 @@
class Order < ApplicationRecord
#primary key - need to be unique
self.primary_key = "order_id"
#primary key - need to be unique
before_create :generate_custom_id
before_create :set_order_date
belongs_to :customer
@@ -40,7 +42,7 @@ class Order < ApplicationRecord
self.adding_line_items
#Add Order Table and Room relation afrer order creation
BookingOrder.create({:booking_id => booking.id, :order => self})
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
#Send order to queue one it done!
process_order_queue
@@ -182,14 +184,6 @@ class Order < ApplicationRecord
return new_items_list
end
private
def validate_api_inputs
end
def set_order_date
self.date = Time.now.utc
end
#Update Items Count and Quantity changes whenever there is changes
def update_products_and_quantity_count
@@ -223,8 +217,10 @@ class Order < ApplicationRecord
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
.group("orders.id, order_items.id,dining_facilities.name")
end
#Origami: Cashier : to view order type Room
def self.get_order_rooms
@@ -250,4 +246,14 @@ class Order < ApplicationRecord
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
.group("orders.id,order_items.id,dining_facilities.name")
end
private
def generate_custom_id
self.order_id = SeedGenerator.generate_id(self.class.name, "ODR")
end
def set_order_date
self.date = Time.now.utc
end
end