From 9c8c1bd0c4004a860f75424868e5f45ae99fbc1b Mon Sep 17 00:00:00 2001 From: bohung Date: Mon, 20 Jul 2020 21:58:29 +0800 Subject: [PATCH] Fix bug for last version. --- app/models/p_hire.rb | 2 +- app/models/property.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/p_hire.rb b/app/models/p_hire.rb index 8c8e311..81cc13a 100644 --- a/app/models/p_hire.rb +++ b/app/models/p_hire.rb @@ -58,7 +58,7 @@ class PHire end def self.recurring_event(start_date,end_date,property_id) - @recurring_events = self.where(:property_id => property_id, :recurring => true, :recurring_end_date.gte => start_date) + @recurring_events = self.where(:property_id => property_id, :recurring_end_date.gte => start_date) @recurring = [] @recurring_events.each do |re| case re.recurring_interval diff --git a/app/models/property.rb b/app/models/property.rb index 1bcaefa..42e9232 100644 --- a/app/models/property.rb +++ b/app/models/property.rb @@ -100,7 +100,7 @@ class Property available = false end if available - bookings = phires.where(:recurring_end_date.gte => stime, :recurring => true) + bookings = phires.where(:recurring_end_date.gte => stime, :recurring => true) + phires.where(:recurring => false,:recurring_end_date => nil) + phires.where(:recurring => false,:recurring_end_date.gte => stime) case interval when 'week' d_step = 1.week