epb_view_models 1.0.2 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.buildspec.yml +13 -0
  3. data/.gitignore +5 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile.lock +22 -17
  6. data/api/schemas/xml/RdSAP-Schema-NI-19.0/RdSAP/Templates/EPC-CollectedData.xsd +13 -12
  7. data/lib/epb_view_models.rb +1 -1
  8. data/lib/helper/energy_band_calculator.rb +1 -1
  9. data/lib/helper/xml_enums_to_output.rb +356 -136
  10. data/lib/presenter/export/domestic.rb +1 -1
  11. data/lib/presenter/rd_sap/report.rb +208 -3
  12. data/lib/presenter/sap/report.rb +208 -2
  13. data/lib/presenter/sap/summary.rb +1 -1
  14. data/lib/view_model/domestic_epc_view_model.rb +4 -0
  15. data/lib/view_model/rd_sap_schema_170/common_schema.rb +16 -0
  16. data/lib/view_model/rd_sap_schema_171/common_schema.rb +16 -0
  17. data/lib/view_model/rd_sap_schema_180/common_schema.rb +16 -0
  18. data/lib/view_model/rd_sap_schema_190/common_schema.rb +16 -0
  19. data/lib/view_model/rd_sap_schema_200/common_schema.rb +16 -4
  20. data/lib/view_model/rd_sap_schema_ni_173/common_schema.rb +16 -0
  21. data/lib/view_model/rd_sap_schema_ni_174/common_schema.rb +16 -0
  22. data/lib/view_model/rd_sap_schema_ni_180/common_schema.rb +16 -0
  23. data/lib/view_model/rd_sap_schema_ni_190/common_schema.rb +16 -0
  24. data/lib/view_model/rd_sap_schema_ni_200/common_schema.rb +16 -4
  25. data/lib/view_model/rd_sap_wrapper.rb +4 -0
  26. data/lib/view_model/sap_schema_102/common_schema.rb +33 -6
  27. data/lib/view_model/sap_schema_102/rdsap.rb +8 -0
  28. data/lib/view_model/sap_schema_110/common_schema.rb +1 -6
  29. data/lib/view_model/sap_schema_110/rdsap.rb +36 -0
  30. data/lib/view_model/sap_schema_110/sap.rb +36 -0
  31. data/lib/view_model/sap_schema_112/common_schema.rb +1 -6
  32. data/lib/view_model/sap_schema_112/rdsap.rb +36 -0
  33. data/lib/view_model/sap_schema_112/sap.rb +36 -0
  34. data/lib/view_model/sap_schema_120/common_schema.rb +0 -4
  35. data/lib/view_model/sap_schema_120/rdsap.rb +36 -0
  36. data/lib/view_model/sap_schema_120/sap.rb +36 -0
  37. data/lib/view_model/sap_schema_130/common_schema.rb +0 -4
  38. data/lib/view_model/sap_schema_130/rdsap.rb +36 -0
  39. data/lib/view_model/sap_schema_130/sap.rb +36 -0
  40. data/lib/view_model/sap_schema_140/common_schema.rb +0 -4
  41. data/lib/view_model/sap_schema_140/rdsap.rb +36 -0
  42. data/lib/view_model/sap_schema_140/sap.rb +36 -0
  43. data/lib/view_model/sap_schema_141/common_schema.rb +0 -4
  44. data/lib/view_model/sap_schema_141/rdsap.rb +36 -0
  45. data/lib/view_model/sap_schema_141/sap.rb +36 -0
  46. data/lib/view_model/sap_schema_142/common_schema.rb +0 -4
  47. data/lib/view_model/sap_schema_142/rdsap.rb +36 -0
  48. data/lib/view_model/sap_schema_142/sap.rb +36 -0
  49. data/lib/view_model/sap_schema_150/common_schema.rb +0 -4
  50. data/lib/view_model/sap_schema_150/rdsap.rb +36 -0
  51. data/lib/view_model/sap_schema_150/sap.rb +36 -0
  52. data/lib/view_model/sap_schema_160/common_schema.rb +0 -4
  53. data/lib/view_model/sap_schema_160/rdsap.rb +36 -0
  54. data/lib/view_model/sap_schema_160/sap.rb +36 -0
  55. data/lib/view_model/sap_schema_161/common_schema.rb +0 -4
  56. data/lib/view_model/sap_schema_161/rdsap.rb +36 -0
  57. data/lib/view_model/sap_schema_161/sap.rb +36 -0
  58. data/lib/view_model/sap_schema_162/common_schema.rb +0 -4
  59. data/lib/view_model/sap_schema_162/rdsap.rb +36 -0
  60. data/lib/view_model/sap_schema_162/sap.rb +36 -0
  61. data/lib/view_model/sap_schema_163/common_schema.rb +0 -4
  62. data/lib/view_model/sap_schema_163/rdsap.rb +36 -0
  63. data/lib/view_model/sap_schema_163/sap.rb +36 -0
  64. data/lib/view_model/sap_schema_170/common_schema.rb +32 -0
  65. data/lib/view_model/sap_schema_171/common_schema.rb +32 -0
  66. data/lib/view_model/sap_schema_1800/common_schema.rb +32 -4
  67. data/lib/view_model/sap_schema_ni_112/common_schema.rb +1 -5
  68. data/lib/view_model/sap_schema_ni_112/rdsap.rb +45 -4
  69. data/lib/view_model/sap_schema_ni_112/sap.rb +35 -0
  70. data/lib/view_model/sap_schema_ni_120/common_schema.rb +1 -5
  71. data/lib/view_model/sap_schema_ni_120/rdsap.rb +40 -0
  72. data/lib/view_model/sap_schema_ni_120/sap.rb +36 -0
  73. data/lib/view_model/sap_schema_ni_130/common_schema.rb +1 -5
  74. data/lib/view_model/sap_schema_ni_130/rdsap.rb +40 -0
  75. data/lib/view_model/sap_schema_ni_130/sap.rb +36 -0
  76. data/lib/view_model/sap_schema_ni_140/common_schema.rb +1 -5
  77. data/lib/view_model/sap_schema_ni_140/rdsap.rb +40 -0
  78. data/lib/view_model/sap_schema_ni_140/sap.rb +36 -0
  79. data/lib/view_model/sap_schema_ni_141/common_schema.rb +1 -5
  80. data/lib/view_model/sap_schema_ni_141/rdsap.rb +40 -0
  81. data/lib/view_model/sap_schema_ni_141/sap.rb +36 -0
  82. data/lib/view_model/sap_schema_ni_142/common_schema.rb +1 -5
  83. data/lib/view_model/sap_schema_ni_142/rdsap.rb +40 -0
  84. data/lib/view_model/sap_schema_ni_142/sap.rb +36 -0
  85. data/lib/view_model/sap_schema_ni_150/common_schema.rb +1 -5
  86. data/lib/view_model/sap_schema_ni_150/rdsap.rb +40 -0
  87. data/lib/view_model/sap_schema_ni_150/sap.rb +36 -0
  88. data/lib/view_model/sap_schema_ni_160/common_schema.rb +2 -6
  89. data/lib/view_model/sap_schema_ni_160/rdsap.rb +36 -0
  90. data/lib/view_model/sap_schema_ni_160/sap.rb +36 -0
  91. data/lib/view_model/sap_schema_ni_161/common_schema.rb +1 -5
  92. data/lib/view_model/sap_schema_ni_161/rdsap.rb +36 -0
  93. data/lib/view_model/sap_schema_ni_161/sap.rb +36 -0
  94. data/lib/view_model/sap_schema_ni_170/common_schema.rb +0 -4
  95. data/lib/view_model/sap_schema_ni_170/rdsap.rb +36 -0
  96. data/lib/view_model/sap_schema_ni_170/sap.rb +36 -0
  97. data/lib/view_model/sap_schema_ni_171/common_schema.rb +0 -4
  98. data/lib/view_model/sap_schema_ni_171/rdsap.rb +36 -0
  99. data/lib/view_model/sap_schema_ni_171/sap.rb +36 -0
  100. data/lib/view_model/sap_schema_ni_172/common_schema.rb +0 -4
  101. data/lib/view_model/sap_schema_ni_172/rdsap.rb +44 -0
  102. data/lib/view_model/sap_schema_ni_172/sap.rb +36 -0
  103. data/lib/view_model/sap_schema_ni_173/common_schema.rb +32 -0
  104. data/lib/view_model/sap_schema_ni_174/common_schema.rb +32 -0
  105. data/lib/view_model/sap_schema_ni_1800/common_schema.rb +32 -4
  106. data/lib/view_model/sap_wrapper.rb +4 -0
  107. metadata +4 -2
@@ -12,8 +12,206 @@ module Presenter
12
12
  .merge(report_from_additional_data)
13
13
  end
14
14
 
15
+ def to_hash_ni
16
+ report_from_ni_assessment_xml
17
+ end
18
+
15
19
  private
16
20
 
21
+ def report_from_ni_assessment_xml
22
+ {
23
+ address1: @view_model.address_line1,
24
+ address2: @view_model.address_line2,
25
+ address3: @view_model.address_line3,
26
+ built_form:
27
+ Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
28
+ co2_emiss_curr_per_floor_area:
29
+ @view_model.co2_emissions_current_per_floor_area,
30
+ co2_emissions_current: @view_model.current_carbon_emission,
31
+ co2_emissions_potential: @view_model.potential_carbon_emission,
32
+ construction_age_band:
33
+ Helper::XmlEnumsToOutput.construction_age_band_lookup(
34
+ @view_model.property_age_band,
35
+ @schema_type,
36
+ @view_model.report_type,
37
+ ),
38
+ current_energy_efficiency: @view_model.current_energy_rating.to_s.chomp,
39
+ current_energy_rating:
40
+ Helper::EnergyBandCalculator.domestic(
41
+ @view_model.current_energy_rating,
42
+ ),
43
+ cylinder_insul_thickness: @view_model.cylinder_insul_thickness,
44
+ cylinder_insulation_type: @view_model.cylinder_insulation_type,
45
+ cylinder_size: @view_model.cylinder_size,
46
+ has_cylinder_thermostat: @view_model.has_cylinder_thermostat == "Y" ? "true" : "false",
47
+ energy_consumption_current: @view_model.primary_energy_use,
48
+ energy_consumption_potential: @view_model.energy_consumption_potential,
49
+ energy_tariff:
50
+ Helper::XmlEnumsToOutput.energy_tariff(
51
+ @view_model.meter_type,
52
+ @view_model.report_type,
53
+ ),
54
+ environment_impact_current: @view_model.environmental_impact_current,
55
+ environment_impact_potential:
56
+ @view_model.environmental_impact_potential,
57
+ extension_count: @view_model.extensions_count,
58
+ fixed_lighting_outlets_count: @view_model.fixed_lighting_outlets_count,
59
+ flat_top_storey: @view_model.top_storey,
60
+ flat_storey_count: @view_model.storey_count,
61
+ floor_description: @view_model.all_floor_descriptions.first,
62
+ floor_energy_eff:
63
+ Helper::XmlEnumsToOutput.energy_rating_string(
64
+ @view_model.all_floor_energy_efficiency_rating.first,
65
+ ),
66
+ floor_env_eff:
67
+ Helper::XmlEnumsToOutput.energy_rating_string(
68
+ @view_model.all_floor_env_energy_efficiency_rating.first,
69
+ ),
70
+ floor_height: @view_model.floor_height.first,
71
+ floor_level: @view_model.floor_level,
72
+ glazed_area:
73
+ Helper::XmlEnumsToOutput.glazed_area_rdsap(@view_model.glazed_area),
74
+ glazed_type:
75
+ Helper::XmlEnumsToOutput.glazed_type_rdsap(
76
+ @view_model.multi_glazing_type,
77
+ ),
78
+ heat_loss_corridor:
79
+ Helper::XmlEnumsToOutput.heat_loss_corridor(
80
+ @view_model.heat_loss_corridor,
81
+ ),
82
+ heating_cost_current: @view_model.heating_cost_current,
83
+ heating_cost_potential: @view_model.heating_cost_potential,
84
+ hot_water_cost_current: @view_model.hot_water_cost_current,
85
+ hot_water_cost_potential: @view_model.hot_water_cost_potential,
86
+ hot_water_energy_eff:
87
+ Helper::XmlEnumsToOutput.energy_rating_string(
88
+ @view_model.hot_water_energy_efficiency_rating,
89
+ ),
90
+ hot_water_env_eff:
91
+ Helper::XmlEnumsToOutput.energy_rating_string(
92
+ @view_model.hot_water_environmental_efficiency_rating,
93
+ ),
94
+ hotwater_description: @view_model.hot_water_description,
95
+ inspection_date: @view_model.date_of_assessment,
96
+ lighting_cost_current: @view_model.lighting_cost_current,
97
+ lighting_cost_potential: @view_model.lighting_cost_potential,
98
+ lighting_description: @view_model.lighting_description,
99
+ lighting_energy_eff:
100
+ Helper::XmlEnumsToOutput.energy_rating_string(
101
+ @view_model.lighting_energy_efficiency_rating,
102
+ ),
103
+ lighting_env_eff:
104
+ Helper::XmlEnumsToOutput.energy_rating_string(@view_model.lighting_environmental_efficiency_rating),
105
+ low_energy_lighting: @view_model.low_energy_lighting,
106
+ low_energy_fixed_lighting_count:
107
+ @view_model.low_energy_fixed_lighting_outlets_count,
108
+ main_fuel: Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
109
+ @schema_type,
110
+ @view_model.report_type),
111
+ mainheat_description:
112
+ @view_model.all_main_heating_descriptions.join(", "),
113
+ mainheat_energy_eff:
114
+ Helper::XmlEnumsToOutput.energy_rating_string(
115
+ @view_model.all_main_heating_energy_efficiency.first,
116
+ ),
117
+ mainheat_env_eff:
118
+ Helper::XmlEnumsToOutput.energy_rating_string(
119
+ @view_model.all_main_heating_environmental_efficiency.first,
120
+ ),
121
+ mainheatc_energy_eff:
122
+ Helper::XmlEnumsToOutput.energy_rating_string(
123
+ @view_model.all_main_heating_controls_energy_efficiency.first,
124
+ ),
125
+ mainheatc_env_eff:
126
+ Helper::XmlEnumsToOutput.energy_rating_string(
127
+ @view_model.all_main_heating_controls_environmental_efficiency.first,
128
+ ),
129
+ mainheatcont_description:
130
+ @view_model.all_main_heating_controls_descriptions.first,
131
+ mains_gas_flag: @view_model.mains_gas,
132
+ mechanical_ventilation:
133
+ Helper::XmlEnumsToOutput.mechanical_ventilation(
134
+ @view_model.mechanical_ventilation,
135
+ @schema_type,
136
+ @view_model.report_type,
137
+ ),
138
+ mech_vent_sys_index_number: nil,
139
+ mechanical_vent_data_source: nil,
140
+ multi_glaze_proportion: @view_model.multiple_glazed_proportion,
141
+ number_habitable_rooms: @view_model.habitable_room_count,
142
+ number_heated_rooms: @view_model.heated_room_count,
143
+ number_open_fireplaces: @view_model.open_fireplaces_count,
144
+ photo_supply: @view_model.photovoltaic_roof_area_percent,
145
+ posttown: @view_model.town,
146
+ postcode: @view_model.postcode,
147
+ potential_energy_efficiency:
148
+ @view_model.potential_energy_rating.to_s.chomp,
149
+ potential_energy_rating:
150
+ Helper::EnergyBandCalculator.domestic(
151
+ @view_model.potential_energy_rating,
152
+ ),
153
+ property_type:
154
+ Helper::XmlEnumsToOutput.property_type(@view_model.property_type),
155
+ report_type: @view_model.report_type,
156
+ roof_description: @view_model.all_roof_descriptions.first,
157
+ roof_energy_eff:
158
+ Helper::XmlEnumsToOutput.energy_rating_string(
159
+ @view_model.all_roof_energy_efficiency_rating.first,
160
+ ),
161
+ roof_env_eff:
162
+ Helper::XmlEnumsToOutput.energy_rating_string(
163
+ @view_model.all_roof_env_energy_efficiency_rating.first,
164
+ ),
165
+ secondheat_description: @view_model.secondary_heating_description,
166
+ sheating_energy_eff:
167
+ Helper::XmlEnumsToOutput.energy_rating_string(
168
+ @view_model.secondary_heating_energy_efficiency_rating,
169
+ ),
170
+ sheating_env_eff:
171
+ Helper::XmlEnumsToOutput.energy_rating_string(
172
+ @view_model.secondary_heating_environmental_efficiency_rating,
173
+ ),
174
+ solar_water_heating_flag: @view_model.solar_water_heating_flag,
175
+ tenure: Helper::XmlEnumsToOutput.tenure(@view_model.tenure),
176
+ thermal_store: nil,
177
+ total_floor_area: @view_model.total_floor_area,
178
+ transaction_type:
179
+ Helper::XmlEnumsToOutput.transaction_type(
180
+ @view_model.transaction_type,
181
+ @view_model.report_type,
182
+ @schema_type,
183
+ ),
184
+ unheated_corridor_length: @view_model.unheated_corridor_length,
185
+ ventilation_type: nil,
186
+ walls_description: @view_model.all_wall_descriptions.first,
187
+ walls_energy_eff:
188
+ Helper::XmlEnumsToOutput.energy_rating_string(
189
+ @view_model.all_wall_energy_efficiency_rating.first,
190
+ ),
191
+ walls_env_eff:
192
+ Helper::XmlEnumsToOutput.energy_rating_string(
193
+ @view_model.all_wall_env_energy_efficiency_rating.first,
194
+ ),
195
+ water_heating_code: @view_model.water_heating_code,
196
+ water_heating_fuel: Helper::XmlEnumsToOutput.fuel_type(
197
+ @view_model.water_heating_fuel,
198
+ @schema_type,
199
+ @view_model.report_type,
200
+ ),
201
+ wind_turbine_count: @view_model.wind_turbine_count,
202
+ windows_description: @view_model.window_description,
203
+ windows_energy_eff:
204
+ Helper::XmlEnumsToOutput.energy_rating_string(
205
+ @view_model.window_energy_efficiency_rating,
206
+ ),
207
+ windows_env_eff:
208
+ Helper::XmlEnumsToOutput.energy_rating_string(
209
+ @view_model.window_environmental_efficiency_rating,
210
+ ),
211
+
212
+ }
213
+ end
214
+
17
215
  def report_from_assessment_xml
18
216
  {
19
217
  assessment_id: Helper::RrnHelper.hash_rrn(@view_model.assessment_id),
@@ -28,6 +226,7 @@ module Presenter
28
226
  Helper::XmlEnumsToOutput.construction_age_band_lookup(
29
227
  @view_model.main_dwelling_construction_age_band_or_year,
30
228
  @schema_type,
229
+ @view_model.report_type,
31
230
  ),
32
231
  current_energy_rating:
33
232
  Helper::EnergyBandCalculator.domestic(
@@ -120,7 +319,7 @@ module Presenter
120
319
  ),
121
320
  photo_supply: @view_model.photovoltaic_roof_area_percent,
122
321
  built_form:
123
- Helper::XmlEnumsToOutput.xml_value_to_string(@view_model.built_form),
322
+ Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
124
323
  mainheat_description:
125
324
  @view_model.all_main_heating_descriptions.join(", "),
126
325
  mainheat_energy_eff:
@@ -154,17 +353,23 @@ module Presenter
154
353
  @view_model.all_wall_env_energy_efficiency_rating.first,
155
354
  ),
156
355
  energy_tariff:
157
- Helper::XmlEnumsToOutput.energy_tariff(@view_model.meter_type),
356
+ Helper::XmlEnumsToOutput.energy_tariff(
357
+ @view_model.meter_type,
358
+ @view_model.report_type,
359
+ ),
158
360
  floor_level: @view_model.floor_level,
159
361
  solar_water_heating_flag: @view_model.solar_water_heating_flag,
160
362
  mechanical_ventilation:
161
363
  Helper::XmlEnumsToOutput.mechanical_ventilation(
162
364
  @view_model.mechanical_ventilation,
163
365
  @schema_type,
366
+ @view_model.report_type,
164
367
  ),
165
368
  floor_height: @view_model.floor_height.first,
166
369
  main_fuel:
167
- Helper::XmlEnumsToOutput.main_fuel_rdsap(@view_model.main_fuel_type),
370
+ Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
371
+ @schema_type,
372
+ @view_model.report_type),
168
373
  floor_description: @view_model.all_floor_descriptions.first,
169
374
  floor_energy_eff:
170
375
  Helper::XmlEnumsToOutput.energy_rating_string(
@@ -12,8 +12,212 @@ module Presenter
12
12
  .merge(report_from_additional_data)
13
13
  end
14
14
 
15
+ def to_hash_ni
16
+ report_from_ni_assessment_xml
17
+ end
18
+
15
19
  private
16
20
 
21
+ def report_from_ni_assessment_xml
22
+ {
23
+ address1: @view_model.address_line1,
24
+ address2: @view_model.address_line2,
25
+ address3: @view_model.address_line3,
26
+ built_form:
27
+ Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
28
+ co2_emiss_curr_per_floor_area:
29
+ @view_model.co2_emissions_current_per_floor_area,
30
+ co2_emissions_current: @view_model.current_carbon_emission,
31
+ co2_emissions_potential: @view_model.potential_carbon_emission,
32
+ construction_age_band:
33
+ Helper::XmlEnumsToOutput.construction_age_band_lookup(
34
+ @view_model.main_dwelling_construction_age_band_or_year,
35
+ @schema_type,
36
+ @view_model.report_type,
37
+ ),
38
+ current_energy_efficiency: @view_model.current_energy_rating.to_s.chomp,
39
+ current_energy_rating:
40
+ Helper::EnergyBandCalculator.domestic(
41
+ @view_model.current_energy_rating,
42
+ ),
43
+ cylinder_insul_thickness: @view_model.cylinder_insul_thickness,
44
+ cylinder_insulation_type: @view_model.cylinder_insulation_type,
45
+ cylinder_size: @view_model.cylinder_size,
46
+ has_cylinder_thermostat: @view_model.has_cylinder_thermostat,
47
+ energy_consumption_current: @view_model.primary_energy_use,
48
+ energy_consumption_potential: @view_model.energy_consumption_potential,
49
+ energy_tariff:
50
+ Helper::XmlEnumsToOutput.energy_tariff(
51
+ @view_model.energy_tariff,
52
+ @view_model.report_type,
53
+ ),
54
+ environment_impact_current: @view_model.environmental_impact_current,
55
+ environment_impact_potential:
56
+ @view_model.environmental_impact_potential,
57
+ extension_count: @view_model.extensions_count,
58
+ fixed_lighting_outlets_count: @view_model.fixed_lighting_outlets_count,
59
+ flat_storey_count: @view_model.storey_count,
60
+ flat_top_storey: @view_model.top_storey,
61
+ floor_description: @view_model.all_floor_descriptions.first,
62
+ floor_energy_eff:
63
+ Helper::XmlEnumsToOutput.energy_rating_string(
64
+ @view_model.all_floor_energy_efficiency_rating.first,
65
+ ),
66
+ floor_env_eff:
67
+ Helper::XmlEnumsToOutput.energy_rating_string(
68
+ @view_model.all_floor_env_energy_efficiency_rating.first,
69
+ ),
70
+ floor_height:
71
+ if @view_model.respond_to?(:floor_height)
72
+ @view_model.floor_height.first
73
+ end,
74
+ floor_level: @view_model.floor_level,
75
+ glazed_area:
76
+ Helper::XmlEnumsToOutput.glazed_area_rdsap(@view_model.glazed_area),
77
+ glazed_type:
78
+ Helper::XmlEnumsToOutput.glazed_type_rdsap(
79
+ @view_model.multi_glazing_type,
80
+ ),
81
+ heat_loss_corridor:
82
+ Helper::XmlEnumsToOutput.heat_loss_corridor(
83
+ @view_model.heat_loss_corridor,
84
+ ),
85
+ heating_cost_current: @view_model.heating_cost_current,
86
+ heating_cost_potential: @view_model.heating_cost_potential,
87
+ hot_water_cost_current: @view_model.hot_water_cost_current,
88
+ hot_water_cost_potential: @view_model.hot_water_cost_potential,
89
+ hot_water_energy_eff:
90
+ Helper::XmlEnumsToOutput.energy_rating_string(
91
+ @view_model.hot_water_energy_efficiency_rating,
92
+ ),
93
+ hot_water_env_eff:
94
+ Helper::XmlEnumsToOutput.energy_rating_string(
95
+ @view_model.hot_water_environmental_efficiency_rating,
96
+ ),
97
+ hotwater_description: @view_model.hot_water_description,
98
+ inspection_date: @view_model.date_of_assessment,
99
+ lighting_cost_current: @view_model.lighting_cost_current,
100
+ lighting_cost_potential: @view_model.lighting_cost_potential,
101
+ lighting_description: @view_model.lighting_description,
102
+ lighting_energy_eff:
103
+ Helper::XmlEnumsToOutput.energy_rating_string(
104
+ @view_model.lighting_energy_efficiency_rating,
105
+ ),
106
+ lighting_env_eff:
107
+ Helper::XmlEnumsToOutput.energy_rating_string(
108
+ @view_model.lighting_environmental_efficiency_rating,
109
+ ),
110
+ low_energy_lighting: @view_model.low_energy_lighting,
111
+ low_energy_fixed_lighting_count:
112
+ @view_model.low_energy_fixed_lighting_outlets_count,
113
+ main_fuel:
114
+ Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
115
+ @schema_type,
116
+ @view_model.report_type),
117
+ mainheat_description:
118
+ @view_model.all_main_heating_descriptions.join(", "),
119
+ mainheat_energy_eff:
120
+ Helper::XmlEnumsToOutput.energy_rating_string(
121
+ @view_model.all_main_heating_energy_efficiency.first,
122
+ ),
123
+ mainheat_env_eff:
124
+ Helper::XmlEnumsToOutput.energy_rating_string(
125
+ @view_model.all_main_heating_environmental_efficiency.first,
126
+ ),
127
+ mainheatc_energy_eff:
128
+ Helper::XmlEnumsToOutput.energy_rating_string(
129
+ @view_model.all_main_heating_controls_energy_efficiency.first,
130
+ ),
131
+ mainheatc_env_eff:
132
+ Helper::XmlEnumsToOutput.energy_rating_string(
133
+ @view_model.all_main_heating_controls_environmental_efficiency.first,
134
+ ),
135
+ mainheatcont_description:
136
+ @view_model.all_main_heating_controls_descriptions.first,
137
+ mains_gas_flag:
138
+ @view_model.respond_to?(:mains_gas) ? @view_model.mains_gas : nil,
139
+ mechanical_ventilation:
140
+ Helper::XmlEnumsToOutput.mechanical_ventilation(
141
+ @view_model.mechanical_ventilation,
142
+ @schema_type,
143
+ @view_model.report_type,
144
+ ),
145
+ mech_vent_sys_index_number: @view_model.mech_vent_sys_index_number,
146
+ mechanical_vent_data_source: @view_model.mechanical_vent_data_source,
147
+ multi_glaze_proportion: @view_model.multiple_glazed_proportion,
148
+ number_habitable_rooms: @view_model.habitable_room_count,
149
+ number_heated_rooms: @view_model.heated_room_count,
150
+ number_open_fireplaces: @view_model.open_fireplaces_count,
151
+ photo_supply: @view_model.photovoltaic_roof_area_percent,
152
+ postcode: @view_model.postcode,
153
+ posttown: @view_model.town,
154
+ potential_energy_efficiency:
155
+ @view_model.potential_energy_rating.to_s.chomp,
156
+ potential_energy_rating:
157
+ Helper::EnergyBandCalculator.domestic(
158
+ @view_model.potential_energy_rating,
159
+ ),
160
+ property_type:
161
+ Helper::XmlEnumsToOutput.property_type(@view_model.property_type),
162
+ report_type: @view_model.report_type,
163
+ roof_description: @view_model.all_roof_descriptions.first,
164
+ roof_energy_eff:
165
+ Helper::XmlEnumsToOutput.energy_rating_string(
166
+ @view_model.all_roof_energy_efficiency_rating.first,
167
+ ),
168
+ roof_env_eff:
169
+ Helper::XmlEnumsToOutput.energy_rating_string(
170
+ @view_model.all_roof_env_energy_efficiency_rating.first,
171
+ ),
172
+ secondheat_description: @view_model.secondary_heating_description,
173
+ sheating_energy_eff:
174
+ Helper::XmlEnumsToOutput.energy_rating_string(
175
+ @view_model.secondary_heating_energy_efficiency_rating,
176
+ ),
177
+ sheating_env_eff:
178
+ Helper::XmlEnumsToOutput.energy_rating_string(
179
+ @view_model.secondary_heating_environmental_efficiency_rating,
180
+ ),
181
+ solar_water_heating_flag: @view_model.solar_water_heating_flag,
182
+ thermal_store: @view_model.thermal_store,
183
+ tenure: Helper::XmlEnumsToOutput.tenure(@view_model.tenure),
184
+ total_floor_area: @view_model.total_floor_area,
185
+ transaction_type:
186
+ Helper::XmlEnumsToOutput.transaction_type(
187
+ @view_model.transaction_type,
188
+ @view_model.report_type,
189
+ @schema_type,
190
+ ),
191
+ ventilation_type: Helper::XmlEnumsToOutput.ventilation_type(@view_model.ventilation_type, @schema_type),
192
+ unheated_corridor_length: @view_model.unheated_corridor_length,
193
+ water_heating_code: @view_model.water_heating_code,
194
+ walls_description: @view_model.all_wall_descriptions.first,
195
+ walls_energy_eff:
196
+ Helper::XmlEnumsToOutput.energy_rating_string(
197
+ @view_model.all_wall_energy_efficiency_rating.first,
198
+ ),
199
+ walls_env_eff:
200
+ Helper::XmlEnumsToOutput.energy_rating_string(
201
+ @view_model.all_wall_env_energy_efficiency_rating.first,
202
+ ),
203
+ water_heating_fuel: Helper::XmlEnumsToOutput.fuel_type(
204
+ @view_model.water_heating_fuel,
205
+ @schema_type,
206
+ @view_model.report_type,
207
+ ),
208
+ wind_turbine_count: @view_model.wind_turbine_count,
209
+ windows_description: @view_model.window_description,
210
+ windows_energy_eff:
211
+ Helper::XmlEnumsToOutput.energy_rating_string(
212
+ @view_model.window_energy_efficiency_rating,
213
+ ),
214
+ windows_env_eff:
215
+ Helper::XmlEnumsToOutput.energy_rating_string(
216
+ @view_model.window_environmental_efficiency_rating,
217
+ ),
218
+ }
219
+ end
220
+
17
221
  def report_from_assessment_xml
18
222
  {
19
223
  assessment_id: Helper::RrnHelper.hash_rrn(@view_model.assessment_id),
@@ -123,7 +327,7 @@ module Presenter
123
327
  ),
124
328
  photo_supply: @view_model.photovoltaic_roof_area_percent,
125
329
  built_form:
126
- Helper::XmlEnumsToOutput.xml_value_to_string(@view_model.built_form),
330
+ Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
127
331
  mainheat_description:
128
332
  @view_model.all_main_heating_descriptions.join(", "),
129
333
  report_type: @view_model.report_type,
@@ -174,7 +378,9 @@ module Presenter
174
378
  @view_model.floor_height.first
175
379
  end,
176
380
  main_fuel:
177
- Helper::XmlEnumsToOutput.main_fuel_sap(@view_model.main_fuel_type),
381
+ Helper::XmlEnumsToOutput.fuel_type(@view_model.main_fuel_type,
382
+ @schema_type,
383
+ @view_model.report_type),
178
384
  floor_description: @view_model.all_floor_descriptions.first,
179
385
  floor_energy_eff:
180
386
  Helper::XmlEnumsToOutput.energy_rating_string(
@@ -150,7 +150,7 @@ module Presenter
150
150
  wind_turbine_count: @view_model.wind_turbine_count,
151
151
  unheated_corridor_length: @view_model.unheated_corridor_length,
152
152
  built_form:
153
- Helper::XmlEnumsToOutput.xml_value_to_string(@view_model.built_form),
153
+ Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
154
154
  mainheat_description:
155
155
  @view_model.all_main_heating_descriptions.join(", "),
156
156
  extensions_count:
@@ -50,6 +50,10 @@ module ViewModel
50
50
  Time.parse(date_of_expiry) < Time.now ? "EXPIRED" : "ENTERED"
51
51
  end
52
52
 
53
+ def water_heating_code
54
+ xpath(%w[Water-Heating-Code])
55
+ end
56
+
53
57
  private
54
58
 
55
59
  def fetch_addendum_numbers
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -514,6 +514,22 @@ module ViewModel
514
514
  end
515
515
  nil
516
516
  end
517
+
518
+ def cylinder_insul_thickness
519
+ xpath(%w[Cylinder-Insulation-Thickness])
520
+ end
521
+
522
+ def cylinder_insulation_type
523
+ xpath(%w[Cylinder-Insulation-Type])
524
+ end
525
+
526
+ def cylinder_size
527
+ xpath(%w[Cylinder-Size])
528
+ end
529
+
530
+ def has_cylinder_thermostat
531
+ xpath(%w[Cylinder-Thermostat])
532
+ end
517
533
  end
518
534
  end
519
535
  end
@@ -346,10 +346,6 @@ module ViewModel
346
346
  xpath(%w[Floor-Heat-Loss])
347
347
  end
348
348
 
349
- def water_heating_code
350
- xpath(%w[Water-Heating-Code])
351
- end
352
-
353
349
  def immersion_heating_type
354
350
  xpath(%w[Immersion-Heating-Type])
355
351
  end
@@ -575,6 +571,22 @@ module ViewModel
575
571
  end
576
572
  nil
577
573
  end
574
+
575
+ def cylinder_insul_thickness
576
+ xpath(%w[Cylinder-Insulation-Thickness])
577
+ end
578
+
579
+ def cylinder_insulation_type
580
+ xpath(%w[Cylinder-Insulation-Type])
581
+ end
582
+
583
+ def cylinder_size
584
+ xpath(%w[Cylinder-Size])
585
+ end
586
+
587
+ def has_cylinder_thermostat
588
+ xpath(%w[Cylinder-Thermostat])
589
+ end
578
590
  end
579
591
  end
580
592
  end
@@ -503,6 +503,22 @@ module ViewModel
503
503
  end
504
504
  nil
505
505
  end
506
+
507
+ def cylinder_insul_thickness
508
+ xpath(%w[Cylinder-Insulation-Thickness])
509
+ end
510
+
511
+ def cylinder_insulation_type
512
+ xpath(%w[Cylinder-Insulation-Type])
513
+ end
514
+
515
+ def cylinder_size
516
+ xpath(%w[Cylinder-Size])
517
+ end
518
+
519
+ def has_cylinder_thermostat
520
+ xpath(%w[Cylinder-Thermostat])
521
+ end
506
522
  end
507
523
  end
508
524
  end
@@ -503,6 +503,22 @@ module ViewModel
503
503
  end
504
504
  nil
505
505
  end
506
+
507
+ def cylinder_insul_thickness
508
+ xpath(%w[Cylinder-Insulation-Thickness])
509
+ end
510
+
511
+ def cylinder_insulation_type
512
+ xpath(%w[Cylinder-Insulation-Type])
513
+ end
514
+
515
+ def cylinder_size
516
+ xpath(%w[Cylinder-Size])
517
+ end
518
+
519
+ def has_cylinder_thermostat
520
+ xpath(%w[Cylinder-Thermostat])
521
+ end
506
522
  end
507
523
  end
508
524
  end