Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2018-01-10 18:14:51 +06:30
2 changed files with 5 additions and 6 deletions

View File

@@ -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."})

View File

@@ -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}