fix error
This commit is contained in:
parent
d159171993
commit
386cb0c5e0
|
@ -108,27 +108,33 @@ class Property
|
||||||
if (b_interval == 'month' || b_interval == 'week') && booking.recurring_end_date.nil?
|
if (b_interval == 'month' || b_interval == 'week') && booking.recurring_end_date.nil?
|
||||||
b_interval = nil
|
b_interval = nil
|
||||||
end
|
end
|
||||||
if b_interval == 'month'
|
if b_interval != 'month' && b_interval != 'week'
|
||||||
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
|
|
||||||
elsif b_interval == 'week'
|
|
||||||
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
|
|
||||||
else
|
|
||||||
b_sdata = booking.start_time
|
b_sdata = booking.start_time
|
||||||
b_edata = booking.end_time
|
b_edata = booking.end_time
|
||||||
end
|
end
|
||||||
while true
|
while true
|
||||||
if b_interval == 'month'
|
if b_interval == 'month'
|
||||||
sdata = stime_tp.day*10000 + stime_tp.hour*100 + stime_tp.minute
|
diff_month = booking.end_time.month - booking.start_time.month
|
||||||
edata = etime_tp.day*10000 + etime_tp.hour*100 + etime_tp.minute
|
diff_month = diff_month + 12 if diff_month < 0
|
||||||
elsif b_interval == 'week'
|
e_month = stime_tp.month + diff_month
|
||||||
sdata = stime_tp.wday*10000 + stime_tp.hour*100 + stime_tp.minute
|
e_year = stime_tp.year + (booking.end_time.year-booking.start_time.year)
|
||||||
edata = etime_tp.wday*10000 + etime_tp.hour*100 + etime_tp.minute
|
e_month = e_month - 12
|
||||||
else
|
b_sdata = "#{stime_tp.year}/#{stime_tp.month}/#{booking.start_time.day} #{booking.start_time.hour}:#{booking.start_time.minute}".to_datetime
|
||||||
sdata = stime_tp
|
b_edata = "#{e_year}/#{e_month}/#{booking.end_time.day} #{booking.end_time.hour}:#{booking.end_time.minute}".to_datetime
|
||||||
edata = etime_tp
|
elsif b_interval = 'week'
|
||||||
|
diff_day = booking.end_time -booking.start_time
|
||||||
|
if (booking.end_time.wday <= booking.start_time.wday && diff_day>1) || diff_day > 7
|
||||||
|
over_one_week = true
|
||||||
|
end
|
||||||
|
b_sdata = stime_tp - stime_tp.wday + booking.start_time.wday
|
||||||
|
if over_one_week && etime_tp.wday<=booking.start_time.wday
|
||||||
|
b_sdata = b_sdata - 7.day
|
||||||
|
end
|
||||||
|
b_edata_tp = b_sdata + (booking.end_time-booking.start_time).to_i.day
|
||||||
|
b_edata = "#{b_edata_tp.year}/#{b_edata_tp.month}/#{b_edata_tp.day} #{booking.end_time.hour}:#{booking.end_time.minute}".to_datetime
|
||||||
end
|
end
|
||||||
|
sdata = stime_tp
|
||||||
|
edata = etime_tp
|
||||||
if etime_tp > booking.start_time
|
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)
|
if (sdata <= b_sdata && edata >= b_sdata) || (sdata >= b_sdata && edata <= b_edata) || (sdata <= b_edata && edata >= b_edata)
|
||||||
available = false
|
available = false
|
||||||
|
|
Loading…
Reference in New Issue