fix error
This commit is contained in:
parent
6c3cf31b03
commit
23c6753646
|
@ -95,12 +95,14 @@ class Property
|
||||||
case interval
|
case interval
|
||||||
when 'week'
|
when 'week'
|
||||||
d_step = 1.week
|
d_step = 1.week
|
||||||
when 'day'
|
when 'month'
|
||||||
d_step = 1.day
|
d_step = 1.month
|
||||||
else
|
else
|
||||||
d_step = 0
|
d_step = 0
|
||||||
end
|
end
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
|
stime_tp = stime
|
||||||
|
etime_tp = etime
|
||||||
b_interval = booking.recurring_interval
|
b_interval = booking.recurring_interval
|
||||||
if b_interval == 'month'
|
if b_interval == 'month'
|
||||||
b_sdata = booking.start_time.day*10000 + booking.start_time.hour*100 + booking.start_time.minute
|
b_sdata = booking.start_time.day*10000 + booking.start_time.hour*100 + booking.start_time.minute
|
||||||
|
@ -111,18 +113,18 @@ class Property
|
||||||
end
|
end
|
||||||
while true
|
while true
|
||||||
if b_interval == 'month'
|
if b_interval == 'month'
|
||||||
sdata = stime.day*10000 + stime.hour*100 + stime.minute
|
sdata = stime_tp.day*10000 + stime_tp.hour*100 + stime_tp.minute
|
||||||
edata = etime.day*10000 + etime.hour*100 + etime.minute
|
edata = etime_tp.day*10000 + etime_tp.hour*100 + etime_tp.minute
|
||||||
elsif b_interval == 'week'
|
elsif b_interval == 'week'
|
||||||
sdata = stime.wday*10000 + stime.hour*100 + stime.minute
|
sdata = stime_tp.wday*10000 + stime_tp.hour*100 + stime_tp.minute
|
||||||
edata = etime.wday*10000 + etime.hour*100 + etime.minute
|
edata = etime_tp.wday*10000 + etime_tp.hour*100 + etime_tp.minute
|
||||||
end
|
end
|
||||||
if (b_sdata <= sdata && b_edata >= sdata) || (b_sdata >= sdata && b_edata <= edata) || (b_sdata <= edata && b_edata >= edata)
|
if (b_sdata <= sdata && b_edata >= sdata) || (b_sdata >= sdata && b_edata <= edata) || (b_sdata <= edata && b_edata >= edata)
|
||||||
available = false
|
available = false
|
||||||
end
|
end
|
||||||
stime = stime + d_step
|
stime_tp = stime_tp + d_step
|
||||||
etime = etime + d_step
|
etime_tp = etime_tp + d_step
|
||||||
break if recurring_end_date.nil? || recurring_end_date < stime
|
break if recurring_end_date.nil? || recurring_end_date < stime_tp
|
||||||
end
|
end
|
||||||
break if available == false
|
break if available == false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue