diff --git a/app/models/property.rb b/app/models/property.rb index a9adfb1..07984fb 100644 --- a/app/models/property.rb +++ b/app/models/property.rb @@ -105,6 +105,9 @@ class Property stime_tp = stime etime_tp = etime b_interval = booking.recurring_interval + if (b_interval == 'month' || b_interval == 'week') && booking.recurring_end_date.nil? + b_interval = nil + end if b_interval == 'month' b_sdata = booking.start_time.day*10000 + booking.start_time.hour*100 + booking.start_time.minute b_edata = booking.end_time.day*10000 + booking.end_time.hour*100 + booking.end_time.minute @@ -126,9 +129,9 @@ class Property sdata = stime_tp edata = etime_tp end - if (sdata <= b_sdata && edata >= b_sdata) || (sdata >= b_sdata && edata <= b_edata) || (sdata <= b_edata && edata >= b_edata) - if etime_tp > booking.start_time - available = false + if etime_tp > booking.start_time + if (sdata <= b_sdata && edata >= b_sdata) || (sdata >= b_sdata && edata <= b_edata) || (sdata <= b_edata && edata >= b_edata) + available = false end end stime_tp = stime_tp + d_step