From 0653bfab53e17e392d9d399f37a8678589c9eea8 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 27 Oct 2017 12:02:38 +0630 Subject: [PATCH] check required for oqs and cashier terminal --- app/models/cashier_terminal.rb | 3 +++ app/models/order_queue_station.rb | 3 +++ app/models/sale.rb | 1 - 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/cashier_terminal.rb b/app/models/cashier_terminal.rb index b488f7c1..bb136117 100755 --- a/app/models/cashier_terminal.rb +++ b/app/models/cashier_terminal.rb @@ -3,4 +3,7 @@ class CashierTerminal < ApplicationRecord has_many :zones, through: :cashier_terminal_by_zones scope :available, -> {where(is_currently_login: false)} + + # validations + validates_presence_of :name, :printer_name end diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 9039a465..d85dffa7 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -10,6 +10,9 @@ class OrderQueueStation < ApplicationRecord scope :active, -> {where(is_active: true)} + # validations + validates_presence_of :station_name, :printer_name + def process_order (order, table_id) oqs_stations = OrderQueueStation.active dining=DiningFacility.find(table_id) diff --git a/app/models/sale.rb b/app/models/sale.rb index dd888fee..2d9dc12d 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -858,7 +858,6 @@ end def self.hourly_sales(today) query= Sale.select("grand_total") .where('payment_status="paid" and sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today) - .group("date_format(receipt_date, '%I %p')") end def self.employee_sales(today)