[feat]Splashpage will display happening next event if no event is happening now

This commit is contained in:
Jimmy 2021-04-17 00:00:52 +08:00
parent 19af4e4f12
commit 2f8cee3c4f
No known key found for this signature in database
GPG key ID: FAE75C760A4A5CC6
7 changed files with 48 additions and 8 deletions

View file

@ -70,6 +70,14 @@ class EventSchedule < ApplicationRecord
event_time_range.overlaps?(now_range)
end
def happening_next?
# TODO: Save start_time with local timezone info when making an event schedule
in_tz_start = start_time.in_time_zone(timezone)
in_tz_start -= in_tz_start.utc_offset
in_tz_start >= Time.now
end
def self.withdrawn_or_canceled_event_schedules(schedule_ids)
EventSchedule
.unscoped