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