remove order item count in origami
This commit is contained in:
@@ -27,37 +27,37 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
bookings = Booking.all
|
# bookings = Booking.all
|
||||||
if !bookings.nil?
|
# if !bookings.nil?
|
||||||
@order_items_count = Hash.new
|
@order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
# bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
if !booking.booking_orders.empty?
|
# if !booking.booking_orders.empty?
|
||||||
booking.booking_orders.each do |booking_order|
|
# booking.booking_orders.each do |booking_order|
|
||||||
order = Order.find(booking_order.order_id)
|
# order = Order.find(booking_order.order_id)
|
||||||
if !order.order_items.empty?
|
# if !order.order_items.empty?
|
||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
# @order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||||
else
|
# else
|
||||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
# @order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
else
|
# else
|
||||||
if !booking.sale_id.nil?
|
# if !booking.sale_id.nil?
|
||||||
sale = Sale.find(booking.sale_id)
|
# sale = Sale.find(booking.sale_id)
|
||||||
if sale.sale_status !='completed'
|
# if sale.sale_status !='completed'
|
||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
else
|
# else
|
||||||
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
puts "@order_items_count"
|
puts "@order_items_count"
|
||||||
puts @order_items_count.to_json
|
puts @order_items_count.to_json
|
||||||
|
|||||||
@@ -13,36 +13,36 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
bookings = Booking.all
|
# bookings = Booking.all
|
||||||
if !bookings.nil?
|
# if !bookings.nil?
|
||||||
@order_items_count = Hash.new
|
# @order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
# bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
if !booking.booking_orders.empty?
|
# if !booking.booking_orders.empty?
|
||||||
booking.booking_orders.each do |booking_order|
|
# booking.booking_orders.each do |booking_order|
|
||||||
order = Order.find(booking_order.order_id)
|
# order = Order.find(booking_order.order_id)
|
||||||
if !order.order_items.empty?
|
# if !order.order_items.empty?
|
||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
# @order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||||
else
|
# else
|
||||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
# @order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
else
|
# else
|
||||||
if !booking.sale_id.nil?
|
# if !booking.sale_id.nil?
|
||||||
sale = Sale.find(booking.sale_id)
|
# sale = Sale.find(booking.sale_id)
|
||||||
if sale.sale_status !='completed'
|
# if sale.sale_status !='completed'
|
||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
else
|
# else
|
||||||
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,37 +23,37 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
bookings = Booking.all
|
# bookings = Booking.all
|
||||||
if !bookings.nil?
|
# if !bookings.nil?
|
||||||
@order_items_count = Hash.new
|
@order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
# bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
if !booking.booking_orders.empty?
|
# if !booking.booking_orders.empty?
|
||||||
booking.booking_orders.each do |booking_order|
|
# booking.booking_orders.each do |booking_order|
|
||||||
order = Order.find(booking_order.order_id)
|
# order = Order.find(booking_order.order_id)
|
||||||
if !order.order_items.empty?
|
# if !order.order_items.empty?
|
||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
# @order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||||
else
|
# else
|
||||||
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
# @order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
else
|
# else
|
||||||
if !booking.sale_id.nil?
|
# if !booking.sale_id.nil?
|
||||||
sale = Sale.find(booking.sale_id)
|
# sale = Sale.find(booking.sale_id)
|
||||||
if sale.sale_status !='completed'
|
# if sale.sale_status !='completed'
|
||||||
if !@order_items_count.key?(booking.dining_facility_id)
|
# if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
else
|
# else
|
||||||
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|
||||||
@room.bookings.active.each do |booking|
|
@room.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
|
|||||||
Reference in New Issue
Block a user