epb_view_models 2.0.4 → 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 +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +3 -3
- data/Gemfile.lock +5 -7
- data/lib/epb_view_models.rb +1 -1
- data/lib/presenter/sap/certificate_details.rb +153 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e37a534e069f0cce99aa4c94a5e819e4c95cae08ab7bac23a3d9e275d70f4ae
|
4
|
+
data.tar.gz: b0caa2877b0671963f6161c235a99011239d341de4819d27a78631cab6e7df40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aecff0311df24627d53c49edab0de44c2dbafec75f54282da82a1a21a73a0f630c06971a28fde0924b890bf4420a0dd0028aad1963734b5cd9fc4b2dd6969dcd
|
7
|
+
data.tar.gz: 1756934eace6db26256901e75241744a1d106f3c5e3604fb9e65e64e13e5b9a83485bfa493b40ed633f1418fd7fbf598cd2a622e6d4739cd906b7393bf679443
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.4
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
ruby "
|
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", "
|
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.
|
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.
|
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 (
|
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 3.3.
|
95
|
+
ruby 3.3.4p94
|
98
96
|
|
99
97
|
BUNDLED WITH
|
100
98
|
2.3.15
|
data/lib/epb_view_models.rb
CHANGED
@@ -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.
|
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:
|
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.5.
|
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)
|