diff --git a/app/controllers/property_hires_controller.rb b/app/controllers/property_hires_controller.rb index 61b60d7..93e0982 100644 --- a/app/controllers/property_hires_controller.rb +++ b/app/controllers/property_hires_controller.rb @@ -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) diff --git a/app/models/p_hire.rb b/app/models/p_hire.rb index 9306e51..4992115 100644 --- a/app/models/p_hire.rb +++ b/app/models/p_hire.rb @@ -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 diff --git a/lib/property_hire/engine.rb b/lib/property_hire/engine.rb index 95908a6..c5d4288 100644 --- a/lib/property_hire/engine.rb +++ b/lib/property_hire/engine.rb @@ -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"