fix error

This commit is contained in:
chiu 2020-05-20 00:07:29 +08:00
parent 79bf7d9694
commit c43dd3c625
1 changed files with 7 additions and 1 deletions

View File

@ -91,7 +91,7 @@ class Property
available = false available = false
end end
if available if available
bookings = self.p_hires.where(:recurring_end_date.gte => stime, :recurring => true) bookings = self.p_hires.where(:recurring_end_date.gte => stime, :recurring => true).or(:recurring => false)
case interval case interval
when 'week' when 'week'
d_step = 1.week d_step = 1.week
@ -110,6 +110,9 @@ class Property
elsif b_interval == 'week' elsif b_interval == 'week'
b_sdata = booking.start_time.wday*10000 + booking.start_time.hour*100 + booking.start_time.minute b_sdata = booking.start_time.wday*10000 + booking.start_time.hour*100 + booking.start_time.minute
b_edata = booking.end_time.wday*10000 + booking.end_time.hour*100 + booking.end_time.minute b_edata = booking.end_time.wday*10000 + booking.end_time.hour*100 + booking.end_time.minute
else
b_sdata = booking.start_time
b_edata = booking.end_time
end end
while true while true
if b_interval == 'month' if b_interval == 'month'
@ -118,6 +121,9 @@ class Property
elsif b_interval == 'week' elsif b_interval == 'week'
sdata = stime_tp.wday*10000 + stime_tp.hour*100 + stime_tp.minute sdata = stime_tp.wday*10000 + stime_tp.hour*100 + stime_tp.minute
edata = etime_tp.wday*10000 + etime_tp.hour*100 + etime_tp.minute edata = etime_tp.wday*10000 + etime_tp.hour*100 + etime_tp.minute
else
sdata = stime_tp
edata = etime_tp
end end
if (sdata <= b_sdata && edata >= b_sdata) || (sdata >= b_sdata && edata <= b_edata) || (sdata <= b_edata && edata >= b_edata) if (sdata <= b_sdata && edata >= b_sdata) || (sdata >= b_sdata && edata <= b_edata) || (sdata <= b_edata && edata >= b_edata)
available = false available = false