From 4146bc4fae880243740d6945cfae4bc7e48df2c2 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 9 Jan 2018 17:22:32 +0630 Subject: [PATCH] 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}