From 4146bc4fae880243740d6945cfae4bc7e48df2c2 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 9 Jan 2018 17:22:32 +0630 Subject: [PATCH 1/2] update menu category valid time --- app/models/menu_category.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/menu_category.rb b/app/models/menu_category.rb index 200c4469..1f45b3ff 100755 --- a/app/models/menu_category.rb +++ b/app/models/menu_category.rb @@ -41,10 +41,10 @@ class MenuCategory < ApplicationRecord menu_category = MenuCategory.find(self.id) menu = Menu.find(menu_category.menu_id) - from = menu.valid_time_from.strftime("%H:%m:%S") - to = menu.valid_time_to.strftime("%H:%m:%S") - current = Time.now.utc.getlocal.strftime("%H:%m:%S") - + from = menu.valid_time_from.strftime("%H:%M:%S") + to = menu.valid_time_to.strftime("%H:%M:%S") + current = Time.now.utc.getlocal.strftime("%H:%M:%S") + from = from.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b} to = to.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b} current = current.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b} From 410cacf279662b7238d77d3b6506bda36e1e1e82 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 10 Jan 2018 17:59:20 +0630 Subject: [PATCH 2/2] update limit tablet autorized --- app/controllers/api/authenticate_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/api/authenticate_controller.rb b/app/controllers/api/authenticate_controller.rb index fcd00f1b..8fbfda5b 100755 --- a/app/controllers/api/authenticate_controller.rb +++ b/app/controllers/api/authenticate_controller.rb @@ -7,8 +7,7 @@ class Api::AuthenticateController < Api::ApiController if emp_id && password @employee = Employee.login(emp_id, password) - - if @employee + if @employee && @employee.role == "waiter" render json: JSON.generate({:status => true, :session_token => @employee.token_session, :name => @employee.name, :role => @employee.role}) else render json: JSON.generate({:status => false, :error_message => "Bad Emp_ID or Password."})