improve template readability

This commit is contained in:
Zach Kemp 2018-04-11 15:03:24 -07:00 committed by James Mason
parent 7d5d935a65
commit 3f2f35283c
3 changed files with 15 additions and 11 deletions

View file

@ -172,6 +172,7 @@ class Program < ApplicationRecord
# * +True+ -> If there is any event for the given date
# * +False+ -> If there is not any event for the given date
def any_event_for_this_date?(date)
return false unless selected_schedule.present?
parsed_date = DateTime.parse("#{date} 00:00").utc
range = parsed_date..(parsed_date + 1.day)
selected_schedule.event_schedules.any? { |es| range.cover?(es.start_time) }