improve template readability

This commit is contained in:
Zach Kemp 2018-04-11 15:03:24 -07:00 • committed by zvkemp
parent 55aa37b8ae
commit 0d68fb912d
3 changed files with 15 additions and 11 deletions

View file

@ -170,6 +170,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) }