update valid time menu
This commit is contained in:
@@ -57,9 +57,15 @@ class MenuCategory < ApplicationRecord
|
||||
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
|
||||
c = current_t.hour
|
||||
if c < 12
|
||||
|
||||
c +=24
|
||||
current = c*3600 + current_t.min* 60 + current_t.sec
|
||||
|
||||
end
|
||||
end
|
||||
else # (after) noon
|
||||
if h > 12
|
||||
@@ -72,6 +78,7 @@ class MenuCategory < ApplicationRecord
|
||||
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
|
||||
@@ -108,3 +115,7 @@ class MenuCategory < ApplicationRecord
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user