Fix bug.
This commit is contained in:
parent
22ab0909ad
commit
27b4b2aab7
|
@ -309,8 +309,9 @@ class PropertyHiresController < ApplicationController
|
|||
|
||||
def get_bookings
|
||||
events =[]
|
||||
allevents = []
|
||||
property = Property.find(params[:property_id]) rescue nil
|
||||
if !property.nil?
|
||||
unless property.nil?
|
||||
if params[:start].present? && params[:end].present?
|
||||
sdt = Time.at(params[:start].to_i)
|
||||
edt = Time.at(params[:end].to_i)
|
||||
|
|
|
@ -124,7 +124,6 @@ class PHire
|
|||
datet = re.date
|
||||
interval = 1.send(re.recurring_interval) rescue 0
|
||||
if interval != 0
|
||||
org_start = re.start_time
|
||||
@start_date = re.start_time
|
||||
recurring_end_date = re.recurring_end_date
|
||||
new_end_date = [recurring_end_date,end_date].min
|
||||
|
@ -135,7 +134,7 @@ class PHire
|
|||
if re.recurring_interval == "week"
|
||||
period_str = 'week'
|
||||
add_interval = (start_date_utc_mjd - @start_date.new_offset(0).mjd)
|
||||
days = 7.day
|
||||
days = 7
|
||||
if add_interval < 0
|
||||
add_interval = -(-add_interval / days)
|
||||
else
|
||||
|
@ -161,7 +160,7 @@ class PHire
|
|||
next
|
||||
end
|
||||
end
|
||||
if @start_date >= start_date && @start_date != org_start
|
||||
if @start_date >= start_date
|
||||
@recurring << re.as_json({:startt=>@start_date,:endt=>@end_date,:datet=>datet})
|
||||
end
|
||||
@start_date += interval
|
||||
|
|
|
@ -11,6 +11,14 @@ module PropertyHire
|
|||
authorizable
|
||||
frontend_enabled
|
||||
data_count 1..30
|
||||
if File.basename($0) != 'rake'
|
||||
begin
|
||||
avoid_page_cache HireEmailSet
|
||||
avoid_page_cache PHire
|
||||
rescue => e
|
||||
puts ["avoid_page_cache", e.to_s]
|
||||
end
|
||||
end
|
||||
side_bar do
|
||||
head_label_i18n 'property_hire.property_hire', icon_class: "icons-map"
|
||||
available_for "users"
|
||||
|
|
Loading…
Reference in New Issue