Class: ReportsManager::LtV2Report

Inherits:
ApplicationService show all
Defined in:
app/services/reports_manager/lt_v2_report.rb

Instance Method Summary collapse

Methods inherited from ApplicationService

call

Constructor Details

#initialize(user_id, property_id, report_type, all_emails = '') ⇒ LtV2Report

Returns a new instance of LtV2Report.



5
6
7
8
9
10
# File 'app/services/reports_manager/lt_v2_report.rb', line 5

def initialize(user_id, property_id, report_type, all_emails = '')
  @user_id = user_id
  @property_id = property_id
  @report_type = report_type
  @all_emails = all_emails
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/services/reports_manager/lt_v2_report.rb', line 12

def call
  lt_defects = ApplicationHelper.lt_defects
  defect_ids = []
  lt_defects.each do |defect|
    defect_ids += defect[1]['ids']
  end

  view_data = {}
  view_data['header_text'] = 'ITEMS NEEDING IMMEDIATE ATTENTION OR REMEDY'
  view_data['footer_text'] = "<div style='margin-left: 25pt;'>\n \n <div>State of Washington Landlord/Tenant Act also requires landlord to respond as follows;<ul><li>24 hours for no hot or cold water, heat, or electricity, or for a condition which is imminently hazardous to life.</li> <li>72 hours for repair of refrigerator, range and oven or a major plumbing fixture supplied by landlord.</li> <li>10 days for all other repairs.</li></ul>Above checklist is based on HUD UPCS standards. Neither the inspector nor the Public Funding Agency assume any liability whatsoever expressed or implied that the above noted health and safety hazards constitute all of the health and safety deficiencies that may be present on this property. Any and all liability for the health and safety hazards noted above, as well as any health and safety hazard that may exist on the property but were not observed by the inspector, are the full and absolute responsibility of the property owner and not the inspector.</div></div>"
  view_data['property_id'] = @property_id
  view_data['user_id'] = @user_id
  view_data['report_type'] = @report_type
  view_data['property'] = Property.find_by_id(@property_id)
  view_data['lt_defects'] = lt_defects
  view_data['all_defects'] = true
  view_data['property_lt_defects'] = InspectionDetail.where(property_id: @property_id).where(deficiency_definition_id: defect_ids)
  view_data['user'] = User.find_by_id(@user_id)
  view_data['all_emails'] = @all_emails
  view_data['file_name'] = view_data['property']['property_name'].gsub('[^A-Za-z0-9]', '-') + '-LT_Defects'
  view_data
end