[fix] Fix time displayed in happening_now.haml; Make event_schedule#happening_now? more efficient
This commit is contained in:
parent
cab293e947
commit
1c54d38094
2 changed files with 3 additions and 2 deletions
|
|
@ -55,9 +55,10 @@ class EventSchedule < ApplicationRecord
|
|||
# True within `threshold` before and after the event.
|
||||
#
|
||||
def happening_now?(threshold = 30.minutes)
|
||||
return false if end_time < Time.now
|
||||
event_time_range = start_time..end_time
|
||||
now_range = (Time.now - threshold)..(Time.now + threshold)
|
||||
event_time_range.overlaps?(now_range) && (end_time > Time.now)
|
||||
event_time_range.overlaps?(now_range)
|
||||
end
|
||||
|
||||
def self.withdrawn_or_canceled_event_schedules(schedule_ids)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue