remove comment data

This commit is contained in:
San Wai Lwin
2018-05-04 10:12:28 +06:30
parent 39264db517
commit 084bf7eb1b
38 changed files with 1824 additions and 1031 deletions

View File

@@ -45,16 +45,21 @@ class MenuCategory < ApplicationRecord
from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S"))
to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S"))
current_t = Time.parse(Time.now.utc.getlocal.strftime("%H:%M:%S"))
from = from_t.hour * 3600 + from_t.min*60 + from_t.sec
to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec
current = current_t.hour * 3600 + current_t.min*60+current_t.sec
if from > to
h = to_t.hour
if h < 12 # before noon
if h == 0
to = 24
to = to * 3600 + to_t.min* 60 + to_t.sec
else
h += 24
to = h*3600 + to_t.min* 60 + to_t.sec
end
else # (after) noon
if h > 12
@@ -64,13 +69,9 @@ class MenuCategory < ApplicationRecord
end
end
# 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}
day = Date.today.wday
dayresult = menu.valid_days.include?(day.to_s)
if current.between?(from, to) && menu.valid_days.include?(day.to_s)
return true
else