fix error
This commit is contained in:
parent
c43dd3c625
commit
73241e7b18
|
@ -83,15 +83,16 @@ class Property
|
|||
end
|
||||
|
||||
def is_already_hired?(stime, etime, interval, recurring_end_date)
|
||||
bookings = self.p_hires.where(:start_time.lte => stime,:end_time.gte => stime,:recurring => false)
|
||||
.or(:start_time.gte => stime,:end_time.lte => etime,:recurring => false)
|
||||
.or(:start_time.lte => etime,:end_time.gte => etime,:recurring => false)
|
||||
phires = self.p_hires
|
||||
bookings_count = phires.where(:start_time.lte => stime,:end_time.gte => stime,:recurring => false).count
|
||||
+ phires.where(:start_time.gte => stime,:end_time.lte => etime,:recurring => false).count
|
||||
+phires.where(:start_time.lte => etime,:end_time.gte => etime,:recurring => false).count
|
||||
available = true
|
||||
if bookings.count != 0
|
||||
if bookings_count != 0
|
||||
available = false
|
||||
end
|
||||
if available
|
||||
bookings = self.p_hires.where(:recurring_end_date.gte => stime, :recurring => true).or(:recurring => false)
|
||||
bookings = phires.where(:recurring_end_date.gte => stime, :recurring => true) + phires.where(:recurring => false)
|
||||
case interval
|
||||
when 'week'
|
||||
d_step = 1.week
|
||||
|
@ -144,12 +145,4 @@ class Property
|
|||
end while (start_time += step) <= end_time
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
Loading…
Reference in New Issue