From b3b5e890eebfe32f54bb4adaa4a7233a32408792 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 13 Apr 2021 11:41:13 +0800 Subject: [PATCH 1/2] [fix]Fix program#any_event_for_this_date? --- app/models/program.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/program.rb b/app/models/program.rb index 19000746..b8ca0da2 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -195,6 +195,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 if date.nil? || date.empty? return false unless selected_schedule.present? parsed_date = DateTime.parse("#{date} 00:00").utc From 7284f6f50d2905002a0e846ae08f2af42112caf9 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Tue, 13 Apr 2021 11:47:13 +0800 Subject: [PATCH 2/2] [fix]Fix empty string check --- app/models/program.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/program.rb b/app/models/program.rb index b8ca0da2..e0196099 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -195,7 +195,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 if date.nil? || date.empty? + return false if date.nil? || date == '' return false unless selected_schedule.present? parsed_date = DateTime.parse("#{date} 00:00").utc