Added tests for program#any_event_for_this_date?

This commit is contained in:
Naman Gupta 2017-11-17 00:02:23 +05:30 committed by Stella Rouzi
parent 6a1d757f43
commit 6eb8c8d6ae
3 changed files with 51 additions and 3 deletions

View file

@ -165,7 +165,7 @@ class Program < ApplicationRecord
# * +False+ -> If there is not any event for the given date
def any_event_for_this_date?(date)
parsed_date = DateTime.parse("#{date} 00:00").utc
EventSchedule.where(schedule: selected_schedule).where(start_time: parsed_date..(parsed_date + 1)).any?
EventSchedule.where(schedule: selected_schedule).where(start_time: parsed_date..(parsed_date + 1.day)).any?
end
##