From b4aa1d125b9f2ee4779b636f3a384992454d2ec6 Mon Sep 17 00:00:00 2001 From: Bohung Date: Tue, 5 Oct 2021 22:26:22 +0800 Subject: [PATCH] Fix display recurring events bug. --- app/models/p_hire.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/p_hire.rb b/app/models/p_hire.rb index 0b8b6f8..02bb871 100644 --- a/app/models/p_hire.rb +++ b/app/models/p_hire.rb @@ -136,7 +136,10 @@ class PHire if unavailable && (unavailable_start_date <= @start_date) && (unavailable_end_date >= @end_date) && !((@start_date.strftime("%w").to_i .. @end_date.strftime("%w").to_i).to_a & unavailable_weekdays).empty? startt = DateTime.parse(@start_date.strftime("%Y-%m-%d " + unavailable_start_time + Time.zone.to_s)) endt = DateTime.parse(@end_date.strftime("%Y-%m-%d " + unavailable_end_time + Time.zone.to_s)) - next if !((startt..endt) & (@start_date..@end_date)).blank? + if !((startt..endt) & (@start_date..@end_date)).blank? + break if (@start_date + interval) > new_end_date + next + end end if @start_date >= start_date @recurring << re.as_json({:startt=>@start_date,:endt=>@end_date,:datet=>datet})