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