[fix] Fix style; Fix start_hour and end_hour in test

This commit is contained in:
Jimmy 2021-03-19 17:22:08 +08:00 committed by CactusPuppy
parent 85fe894876
commit 39d4960b69
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
3 changed files with 3 additions and 2 deletions

View file

@ -56,6 +56,7 @@ class EventSchedule < ApplicationRecord
#
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)