epb_view_models 2.0.3 → 2.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 768d1bc10b159343564b8a6a1d9b7392798195b2d98f9657744466cc378bcce7
4
- data.tar.gz: d63ea784d42ac5f2e9740a36001f6695010c08c776c75d39701b9f3ca61022e8
3
+ metadata.gz: 6e37a534e069f0cce99aa4c94a5e819e4c95cae08ab7bac23a3d9e275d70f4ae
4
+ data.tar.gz: b0caa2877b0671963f6161c235a99011239d341de4819d27a78631cab6e7df40
5
5
  SHA512:
6
- metadata.gz: 5a988e042c962e0d0f12da4be1b2cc52a60a79fb581cddaa43ff897af2ab8ed9b182d56b97397785490924a5c033f4cddfc4ec17bcda35d42bbf7092cbe003e1
7
- data.tar.gz: 407b7f502348d6b181d44027ce7db28420da8e1c6ea1cbd1508ed60c9fc5f364c3f71f530d82918ea24e62a25f4f1020ce3ec6e6a45e09157484af31c2bc24be
6
+ metadata.gz: aecff0311df24627d53c49edab0de44c2dbafec75f54282da82a1a21a73a0f630c06971a28fde0924b890bf4420a0dd0028aad1963734b5cd9fc4b2dd6969dcd
7
+ data.tar.gz: 1756934eace6db26256901e75241744a1d106f3c5e3604fb9e65e64e13e5b9a83485bfa493b40ed633f1418fd7fbf598cd2a622e6d4739cd906b7393bf679443
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.3
1
+ 3.3.4
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ruby ">=2.7", "<3.2"
3
+ ruby "3.3.4"
4
4
 
5
5
  source "https://rubygems.org"
6
6
 
@@ -10,6 +10,6 @@ group :test do
10
10
  gem "rubocop-govuk", "~> 4.7.0", require: false
11
11
  end
12
12
 
13
- gem "nokogiri", "~> 1.16"
14
- gem "rexml", "~> 3.2", ">= 3.2.5"
13
+ gem "nokogiri", "~> 1.16", ">= 1.16.5"
14
+ gem "rexml", ">= 3.3.9"
15
15
  gem "zeitwerk", "~> 2.6"
data/Gemfile.lock CHANGED
@@ -21,11 +21,9 @@ GEM
21
21
  i18n (1.14.4)
22
22
  concurrent-ruby (~> 1.0)
23
23
  json (2.7.1)
24
- mini_portile2 (2.8.5)
25
24
  minitest (5.22.2)
26
25
  mutex_m (0.2.0)
27
- nokogiri (1.16.2)
28
- mini_portile2 (~> 2.8.2)
26
+ nokogiri (1.18.1-arm64-darwin)
29
27
  racc (~> 1.4)
30
28
  parallel (1.24.0)
31
29
  parser (3.3.0.5)
@@ -36,7 +34,7 @@ GEM
36
34
  rainbow (3.1.1)
37
35
  rake (13.0.6)
38
36
  regexp_parser (2.9.0)
39
- rexml (3.2.6)
37
+ rexml (3.4.0)
40
38
  rspec (3.13.0)
41
39
  rspec-core (~> 3.13.0)
42
40
  rspec-expectations (~> 3.13.0)
@@ -86,15 +84,15 @@ PLATFORMS
86
84
  ruby
87
85
 
88
86
  DEPENDENCIES
89
- nokogiri (~> 1.16)
87
+ nokogiri (~> 1.16, >= 1.16.5)
90
88
  rake (~> 13.0.6)
91
- rexml (~> 3.2, >= 3.2.5)
89
+ rexml (>= 3.3.9)
92
90
  rspec (~> 3.0)
93
91
  rubocop-govuk (~> 4.7.0)
94
92
  zeitwerk (~> 2.6)
95
93
 
96
94
  RUBY VERSION
97
- ruby 2.7.5p203
95
+ ruby 3.3.4p94
98
96
 
99
97
  BUNDLED WITH
100
98
  2.3.15
@@ -458,8 +458,8 @@
458
458
  </Recommendation>
459
459
  <Recommendation>
460
460
  <Improvement-Number>59</Improvement-Number>
461
- <Improvement-Summary language="1">High heat retention storage heaters and dual immersion cylinder</Improvement-Summary>
462
- <Improvement-Summary language="2">Gwresogyddion storio sy’n cadw llawer o wres a silindr sydd â dau dwymwr tanddwr</Improvement-Summary>
461
+ <Improvement-Summary language="1">High heat retention storage heaters and dual immersion cylinder and dual rate meter<</Improvement-Summary>
462
+ <Improvement-Summary language="2">Gwresogyddion storio sy’n cadw llawer o wres a silindr sydd â dau dwymwr tanddwr a mesurydd cyfradd ddeuol</Improvement-Summary>
463
463
  <Improvement-Heading language="1">High heat retention storage heaters</Improvement-Heading>
464
464
  <Improvement-Heading language="2">Gwresogyddion storio sy’n cadw llawer o wres</Improvement-Heading>
465
465
  <Improvement-Description language="1">High heat retention storage heaters</Improvement-Description>
@@ -476,8 +476,8 @@
476
476
  </Recommendation>
477
477
  <Recommendation>
478
478
  <Improvement-Number>61</Improvement-Number>
479
- <Improvement-Summary language="1">High heat retention storage heaters and dual immersion cylinder</Improvement-Summary>
480
- <Improvement-Summary language="2">Gwresogyddion storio sy’n cadw llawer o wres a silindr sydd â dau dwymwr tanddwr</Improvement-Summary>
479
+ <Improvement-Summary language="1">High heat retention storage heaters and dual immersion cylinder and dual rate meter</Improvement-Summary>
480
+ <Improvement-Summary language="2">Gwresogyddion storio sy’n cadw llawer o wres a silindr sydd â dau dwymwr tanddwr a mesurydd cyfradd ddeuol</Improvement-Summary>
481
481
  <Improvement-Heading language="1">High heat retention storage heaters</Improvement-Heading>
482
482
  <Improvement-Heading language="2">Gwresogyddion storio sy’n cadw llawer o wres</Improvement-Heading>
483
483
  <Improvement-Description language="1">High heat retention storage heaters</Improvement-Description>
@@ -485,8 +485,8 @@
485
485
  </Recommendation>
486
486
  <Recommendation>
487
487
  <Improvement-Number>62</Improvement-Number>
488
- <Improvement-Summary language="1">High heat retention storage heaters</Improvement-Summary>
489
- <Improvement-Summary language="2">Gwresogyddion storio sy’n cadw llawer o wres</Improvement-Summary>
488
+ <Improvement-Summary language="1">High heat retention storage heaters and dual rate meter</Improvement-Summary>
489
+ <Improvement-Summary language="2">Gwresogyddion storio sy’n cadw llawer o wres a mesurydd cyfradd ddeuol</Improvement-Summary>
490
490
  <Improvement-Heading language="1">High heat retention storage heaters</Improvement-Heading>
491
491
  <Improvement-Heading language="2">Gwresogyddion storio sy’n cadw llawer o wres</Improvement-Heading>
492
492
  <Improvement-Description language="1">High heat retention storage heaters</Improvement-Description>
@@ -167,7 +167,7 @@ This is actually the type differentiator for Property but only a limited number
167
167
  <xs:documentation>Mechanical ventilation duct insulation; if MVHR from PCDB.</xs:documentation>
168
168
  </xs:annotation>
169
169
  </xs:element>
170
- <xs:element name="Mechanical-Ventilation-Duct-Insulation" type="SAP-DuctInsulationCode" minOccurs="0">
170
+ <xs:element name="Mechanical-Vent-Duct-Insulation" type="SAP-DuctInsulationCode" minOccurs="0">
171
171
  <xs:annotation>
172
172
  <xs:documentation>Relevant when mechanical ventilation system is from PCDB.</xs:documentation>
173
173
  </xs:annotation>
@@ -441,7 +441,12 @@ For the purpose of calculating the overall Energy Assessment for the property de
441
441
  </xs:annotation>
442
442
  </xs:element>
443
443
  <xs:element name="SAP-Room-In-Roof" type="SAP-Room-In-Roof" minOccurs="0"/>
444
- <xs:element name="SAP-Alternative-Wall" type="SAP-Alternative-Wall" minOccurs="0">
444
+ <xs:element name="SAP-Alternative-Wall-1" type="SAP-Alternative-Wall" minOccurs="0">
445
+ <xs:annotation>
446
+ <xs:documentation>Included only for building parts that have an alternative wall</xs:documentation>
447
+ </xs:annotation>
448
+ </xs:element>
449
+ <xs:element name="SAP-Alternative-Wall-2" type="SAP-Alternative-Wall" minOccurs="0">
445
450
  <xs:annotation>
446
451
  <xs:documentation>Included only for building parts that have an alternative wall</xs:documentation>
447
452
  </xs:annotation>
@@ -452,7 +457,6 @@ For the purpose of calculating the overall Energy Assessment for the property de
452
457
  <xs:element name="SAP-Alternative-Wall" type="SAP-Alternative-Wall"/>
453
458
  <xs:complexType name="SAP-Alternative-Wall">
454
459
  <xs:all>
455
- <xs:element name="Alternative-Wall-Number" type="AlternativeWallCount"/>
456
460
  <xs:element name="Wall-Construction" type="WallConstructionCode"/>
457
461
  <xs:element name="Wall-Insulation-Type" type="WallInsulationCode"/>
458
462
  <xs:element name="Wall-Area" type="Measurement"/>
@@ -2008,11 +2008,6 @@ Northern Ireland: 2014 onwards (TBA)</xs:documentation>
2008
2008
  <xs:documentation>125mm</xs:documentation>
2009
2009
  </xs:annotation>
2010
2010
  </xs:enumeration>
2011
- <xs:enumeration value="125mm">
2012
- <xs:annotation>
2013
- <xs:documentation>125mm</xs:documentation>
2014
- </xs:annotation>
2015
- </xs:enumeration>
2016
2011
  <xs:enumeration value="150mm">
2017
2012
  <xs:annotation>
2018
2013
  <xs:documentation>150mm</xs:documentation>
@@ -2182,12 +2177,6 @@ Northern Ireland: 2014 onwards (TBA)</xs:documentation>
2182
2177
  <xs:maxInclusive value="4"/>
2183
2178
  </xs:restriction>
2184
2179
  </xs:simpleType>
2185
- <xs:simpleType name="AlternativeWallCount">
2186
- <xs:restriction base="xs:integer">
2187
- <xs:minInclusive value="1"/>
2188
- <xs:maxInclusive value="2"/>
2189
- </xs:restriction>
2190
- </xs:simpleType>
2191
2180
  <xs:simpleType name="SAP-OpeningDataSourceCode">
2192
2181
  <xs:restriction base="xs:integer">
2193
2182
  <xs:enumeration value="2">
@@ -5,7 +5,7 @@ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
5
5
  loader.setup
6
6
 
7
7
  module EpbViewModels
8
- VERSION = "2.0.3"
8
+ VERSION = "2.0.5"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -0,0 +1,153 @@
1
+ module Presenter
2
+ module Sap
3
+ class CertificateDetails
4
+ def initialize(view_model)
5
+ @view_model = view_model
6
+ end
7
+
8
+ def to_hash
9
+ estimated_energy_cost =
10
+ Helper::EstimatedCostPotentialSavingHelper.new.estimated_cost(
11
+ @view_model.heating_cost_current,
12
+ @view_model.hot_water_cost_current,
13
+ @view_model.lighting_cost_current,
14
+ )
15
+ {
16
+ type_of_assessment: @view_model.type_of_assessment,
17
+ assessment_id: @view_model.assessment_id,
18
+ date_of_expiry: @view_model.date_of_expiry,
19
+ date_of_assessment: @view_model.date_of_assessment,
20
+ date_of_registration: @view_model.date_of_registration,
21
+ date_registered: @view_model.date_of_registration,
22
+ address_id: @view_model.address_id,
23
+ address_line1: @view_model.address_line1,
24
+ address_line2: @view_model.address_line2,
25
+ address_line3: @view_model.address_line3,
26
+ address_line4: nil,
27
+ town: @view_model.town,
28
+ postcode: @view_model.postcode,
29
+ assessor: {
30
+ scheme_assessor_id: @view_model.scheme_assessor_id,
31
+ name: @view_model.assessor_name,
32
+ contact_details: {
33
+ email: @view_model.assessor_email,
34
+ telephone: @view_model.assessor_telephone,
35
+ },
36
+ },
37
+ current_carbon_emission:
38
+ convert_to_big_decimal(@view_model.current_carbon_emission),
39
+ current_energy_efficiency_band: Helper::EnergyBandCalculator.domestic(@view_model.current_energy_rating),
40
+ current_energy_efficiency_rating: @view_model.current_energy_rating,
41
+ dwelling_type: @view_model.dwelling_type,
42
+ estimated_energy_cost:,
43
+ main_fuel_type: @view_model.main_fuel_type,
44
+ heat_demand: {
45
+ current_space_heating_demand:
46
+ @view_model.current_space_heating_demand&.to_i,
47
+ current_water_heating_demand:
48
+ @view_model.current_water_heating_demand&.to_i,
49
+ impact_of_cavity_insulation: @view_model.respond_to?(:impact_of_cavity_insulation) ? @view_model.impact_of_cavity_insulation : nil,
50
+ impact_of_loft_insulation: @view_model.respond_to?(:impact_of_loft_insulation) ? @view_model.impact_of_loft_insulation : nil,
51
+ impact_of_solid_wall_insulation: @view_model.respond_to?(:impact_of_solid_wall_insulation) ? @view_model.impact_of_solid_wall_insulation : nil,
52
+ },
53
+ heating_cost_current: @view_model.heating_cost_current,
54
+ heating_cost_potential: @view_model.heating_cost_potential,
55
+ hot_water_cost_current: @view_model.hot_water_cost_current,
56
+ hot_water_cost_potential: @view_model.hot_water_cost_potential,
57
+ lighting_cost_current: @view_model.lighting_cost_current,
58
+ lighting_cost_potential: @view_model.lighting_cost_potential,
59
+ potential_carbon_emission:
60
+ convert_to_big_decimal(@view_model.potential_carbon_emission),
61
+ potential_energy_efficiency_band: Helper::EnergyBandCalculator.domestic(@view_model.potential_energy_rating),
62
+ potential_energy_efficiency_rating: @view_model.potential_energy_rating,
63
+ potential_energy_saving:
64
+ Helper::EstimatedCostPotentialSavingHelper.new.potential_saving(
65
+ @view_model.heating_cost_potential,
66
+ @view_model.hot_water_cost_potential,
67
+ @view_model.lighting_cost_potential,
68
+ estimated_energy_cost,
69
+ ),
70
+ primary_energy_use: @view_model.respond_to?(:primary_energy_use) ? @view_model.primary_energy_use : nil,
71
+ energy_consumption_potential: @view_model.energy_consumption_potential,
72
+ property_age_band: @view_model.respond_to?(:property_age_band) ? @view_model.property_age_band : nil,
73
+ property_summary: @view_model.property_summary,
74
+ recommended_improvements:
75
+ @view_model.improvements.map do |improvement|
76
+ improvement[:energy_performance_band_improvement] =
77
+ Helper::EnergyBandCalculator.domestic(improvement[:energy_performance_rating_improvement])
78
+ improvement
79
+ end,
80
+ lzc_energy_sources: @view_model.lzc_energy_sources,
81
+ related_party_disclosure_number: @view_model.respond_to?(:related_party_disclosure_number) ? @view_model.related_party_disclosure_number : nil,
82
+ related_party_disclosure_text:
83
+ @view_model.related_party_disclosure_text,
84
+ tenure: @view_model.respond_to?(:tenure) ? @view_model.tenure : nil,
85
+ transaction_type: @view_model.respond_to?(:transaction_type) ? @view_model.transaction_type : nil,
86
+ total_floor_area: convert_to_big_decimal(@view_model.total_floor_area),
87
+ total_roof_area: @view_model.respond_to?(:total_roof_area) ? @view_model.total_roof_area : nil,
88
+ status: @view_model.status,
89
+ environmental_impact_current: @view_model.environmental_impact_current,
90
+ environmental_impact_potential:
91
+ @view_model.environmental_impact_potential,
92
+ co2_emissions_current_per_floor_area:
93
+ @view_model.co2_emissions_current_per_floor_area,
94
+ mains_gas: @view_model.respond_to?(:mains_gas) ? @view_model.mains_gas : nil,
95
+ level: @view_model.level,
96
+ top_storey: @view_model.top_storey,
97
+ storey_count: @view_model.respond_to?(:storey_count) ? @view_model.storey_count : nil,
98
+ main_heating_controls: @view_model.main_heating_controls,
99
+ multiple_glazed_proportion: @view_model.respond_to?(:multiple_glazed_proportion) ? @view_model.multiple_glazed_proportion : nil,
100
+ glazed_area: @view_model.respond_to?(:glazed_area) ? @view_model.glazed_area : nil,
101
+ habitable_room_count: @view_model.respond_to?(:habitable_room_count) ? @view_model.habitable_room_count : nil,
102
+ heated_room_count: @view_model.respond_to?(:heated_room_count) ? @view_model.heated_room_count : nil,
103
+ low_energy_lighting: @view_model.respond_to?(:low_energy_lighting) ? @view_model.low_energy_lighting : nil,
104
+ fixed_lighting_outlets_count: @view_model.respond_to?(:fixed_lighting_outlets_count) ? @view_model.fixed_lighting_outlets_count : nil,
105
+ low_energy_fixed_lighting_outlets_count:
106
+ @view_model.respond_to?(:low_energy_fixed_lighting_outlets_count) ? @view_model.low_energy_fixed_lighting_outlets_count : nil,
107
+ open_fireplaces_count: @view_model.respond_to?(:open_fireplaces_count) ? @view_model.open_fireplaces_count : nil,
108
+ hot_water_description: @view_model.hot_water_description,
109
+ hot_water_energy_efficiency_rating:
110
+ @view_model.hot_water_energy_efficiency_rating,
111
+ hot_water_environmental_efficiency_rating:
112
+ @view_model.hot_water_environmental_efficiency_rating,
113
+ window_description: @view_model.window_description,
114
+ window_energy_efficiency_rating:
115
+ @view_model.window_energy_efficiency_rating,
116
+ window_environmental_efficiency_rating:
117
+ @view_model.window_environmental_efficiency_rating,
118
+ secondary_heating_description:
119
+ @view_model.secondary_heating_description,
120
+ secondary_heating_energy_efficiency_rating:
121
+ @view_model.secondary_heating_energy_efficiency_rating,
122
+ secondary_heating_environmental_efficiency_rating:
123
+ @view_model.secondary_heating_environmental_efficiency_rating,
124
+ lighting_description: @view_model.lighting_description,
125
+ lighting_energy_efficiency_rating:
126
+ @view_model.lighting_energy_efficiency_rating,
127
+ lighting_environmental_efficiency_rating:
128
+ @view_model.lighting_environmental_efficiency_rating,
129
+ photovoltaic_roof_area_percent: @view_model.respond_to?(:photovoltaic_roof_area_percent) ? @view_model.photovoltaic_roof_area_percent : nil,
130
+ heat_loss_corridor: @view_model.respond_to?(:heat_loss_corridor) ? @view_model.heat_loss_corridor : nil,
131
+ wind_turbine_count: @view_model.wind_turbine_count,
132
+ unheated_corridor_length: @view_model.respond_to?(:unheated_corridor_length) ? @view_model.unheated_corridor_length : nil,
133
+ built_form:
134
+ Helper::XmlEnumsToOutput.built_form_string(@view_model.built_form),
135
+ main_heat_description:
136
+ @view_model.all_main_heating_descriptions.join(", "),
137
+ extensions_count: @view_model.respond_to?(:extensions_count) ? @view_model.extensions_count : nil,
138
+ addendum: @view_model.addendum,
139
+ gas_smart_meter_present: @view_model.respond_to?(:gas_smart_meter_present) ? @view_model.gas_smart_meter_present : nil,
140
+ electricity_smart_meter_present: @view_model.respond_to?(:electricity_smart_meter_present) ? @view_model.electricity_smart_meter_present : nil,
141
+ }
142
+ end
143
+
144
+ private
145
+
146
+ def convert_to_big_decimal(node)
147
+ return "" unless node
148
+
149
+ BigDecimal(node, 0)
150
+ end
151
+ end
152
+ end
153
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epb_view_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - DLUHC Energy Performance of Buildings
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-21 00:00:00.000000000 Z
11
+ date: 2025-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -1702,6 +1702,7 @@ files:
1702
1702
  - lib/presenter/rd_sap/recommendation_report.rb
1703
1703
  - lib/presenter/rd_sap/report.rb
1704
1704
  - lib/presenter/rd_sap/summary.rb
1705
+ - lib/presenter/sap/certificate_details.rb
1705
1706
  - lib/presenter/sap/domestic_digest.rb
1706
1707
  - lib/presenter/sap/export_configuration.rb
1707
1708
  - lib/presenter/sap/recommendation_report.rb
@@ -1895,7 +1896,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1895
1896
  - !ruby/object:Gem::Version
1896
1897
  version: '0'
1897
1898
  requirements: []
1898
- rubygems_version: 3.3.26
1899
+ rubygems_version: 3.5.11
1899
1900
  signing_key:
1900
1901
  specification_version: 4
1901
1902
  summary: Library used to parse Energy Performance Certificates (EPC)