epb_view_models 1.1.2 → 1.1.4

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: bbfe61f3dd422c63e6304d3db50ca8763c08ff397aa9beacd7bcde040b19d3b1
4
- data.tar.gz: b3e90e80af3d5d0de7ec5946c88db890a68a4d07fce88329147d2f52fbe85314
3
+ metadata.gz: 8eabee1c7bfdbe1bf088b218d9b2ac1f730810a790bfd84266255855668fa80f
4
+ data.tar.gz: 8969240277cfe72cbee1e1ff39f9e4b6fe8145daca3bf8f15af9f8c004766333
5
5
  SHA512:
6
- metadata.gz: c4ab329d35fd03b1ef595b453c68fb85c34401000eef9bb9d2ad58af7a6fa68d9b4eb850102370e524190321e54cf0b127cb611c8f0a107e9e758bdaa1a1bbd3
7
- data.tar.gz: 6205e6087b08acaeb89f181282af4f735d0cb6a0d42d0b769d9d08984fc8c6222b636606860fb76a0bdf9b356dff26b67baa1511201e9c9fa306af20ba61e0b6
6
+ metadata.gz: 7d4eb10d848147f8039a7171a598f03f183c5cc4f8348ce587ce652e86859d1831427ff1dbda4819e938d9a6a3f081e4a90a2b2edb07b9efe2748d2517fc6ae8
7
+ data.tar.gz: 21eb8a3a148862f30be675a623e082ae8064570391b76dbaad076da7e4b79860bb854ba5559fd35844e90ca6731d7566e68bd82058f4789fd16b6b618e7edea4
data/Gemfile.lock CHANGED
@@ -1,44 +1,45 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (7.0.4.2)
4
+ activesupport (7.0.6)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
6
  i18n (>= 1.6, < 2)
7
7
  minitest (>= 5.1)
8
8
  tzinfo (~> 2.0)
9
9
  ast (2.4.2)
10
- concurrent-ruby (1.2.0)
10
+ concurrent-ruby (1.2.2)
11
11
  diff-lcs (1.5.0)
12
- i18n (1.12.0)
12
+ i18n (1.14.1)
13
13
  concurrent-ruby (~> 1.0)
14
14
  json (2.6.3)
15
- mini_portile2 (2.8.1)
16
- minitest (5.17.0)
17
- nokogiri (1.14.0)
18
- mini_portile2 (~> 2.8.0)
15
+ mini_portile2 (2.8.4)
16
+ minitest (5.18.1)
17
+ nokogiri (1.15.3)
18
+ mini_portile2 (~> 2.8.2)
19
19
  racc (~> 1.4)
20
- parallel (1.22.1)
21
- parser (3.2.0.0)
20
+ parallel (1.23.0)
21
+ parser (3.2.2.3)
22
22
  ast (~> 2.4.1)
23
- racc (1.6.2)
24
- rack (3.0.4.1)
23
+ racc
24
+ racc (1.7.1)
25
+ rack (3.0.8)
25
26
  rainbow (3.1.1)
26
27
  rake (13.0.6)
27
- regexp_parser (2.6.2)
28
+ regexp_parser (2.8.1)
28
29
  rexml (3.2.5)
29
30
  rspec (3.12.0)
30
31
  rspec-core (~> 3.12.0)
31
32
  rspec-expectations (~> 3.12.0)
32
33
  rspec-mocks (~> 3.12.0)
33
- rspec-core (3.12.0)
34
+ rspec-core (3.12.2)
34
35
  rspec-support (~> 3.12.0)
35
- rspec-expectations (3.12.2)
36
+ rspec-expectations (3.12.3)
36
37
  diff-lcs (>= 1.2.0, < 2.0)
37
38
  rspec-support (~> 3.12.0)
38
- rspec-mocks (3.12.3)
39
+ rspec-mocks (3.12.6)
39
40
  diff-lcs (>= 1.2.0, < 2.0)
40
41
  rspec-support (~> 3.12.0)
41
- rspec-support (3.12.0)
42
+ rspec-support (3.12.1)
42
43
  rubocop (1.35.0)
43
44
  json (~> 2.3)
44
45
  parallel (~> 1.10)
@@ -65,11 +66,11 @@ GEM
65
66
  rubocop (~> 1.0)
66
67
  rubocop-rspec (2.12.1)
67
68
  rubocop (~> 1.31)
68
- ruby-progressbar (1.11.0)
69
+ ruby-progressbar (1.13.0)
69
70
  tzinfo (2.0.6)
70
71
  concurrent-ruby (~> 1.0)
71
72
  unicode-display_width (2.4.2)
72
- zeitwerk (2.6.6)
73
+ zeitwerk (2.6.8)
73
74
 
74
75
  PLATFORMS
75
76
  ruby
@@ -5,9 +5,10 @@ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
5
5
  loader.setup
6
6
 
7
7
  module EpbViewModels
8
- VERSION = "1.1.2"
8
+ VERSION = "1.1.4"
9
9
  end
10
10
 
11
+
11
12
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
12
13
  # Source: http://jeffgardner.org/2011/08/04/rails-string-to-boolean-method/
13
14
  class String
@@ -103,6 +103,7 @@ module Presenter
103
103
  tenure: @view_model.tenure,
104
104
  transaction_type: @view_model.transaction_type,
105
105
  total_floor_area: convert_to_big_decimal(@view_model.total_floor_area),
106
+ total_roof_area: @view_model.respond_to?(:total_roof_area) ? @view_model.total_roof_area : nil,
106
107
  status: @view_model.status,
107
108
  environmental_impact_current: @view_model.environmental_impact_current,
108
109
  environmental_impact_potential:
@@ -56,6 +56,18 @@ module ViewModel
56
56
  def water_heating_fuel
57
57
  xpath(%w[Water-Fuel-Type])
58
58
  end
59
+
60
+ def total_roof_area
61
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
62
+ return nil if roofs.count == 0
63
+
64
+ total_roof_area = 0
65
+ roofs.each do |roof|
66
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
67
+ total_roof_area += roof_area
68
+ end
69
+ total_roof_area
70
+ end
59
71
  end
60
72
  end
61
73
  end
@@ -62,6 +62,18 @@ module ViewModel
62
62
  def water_heating_fuel
63
63
  xpath(%w[Water-Fuel-Type])
64
64
  end
65
+
66
+ def total_roof_area
67
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
68
+ return nil if roofs.count == 0
69
+
70
+ total_roof_area = 0
71
+ roofs.each do |roof|
72
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
73
+ total_roof_area += roof_area
74
+ end
75
+ total_roof_area
76
+ end
65
77
  end
66
78
  end
67
79
  end
@@ -44,6 +44,18 @@ module ViewModel
44
44
  def water_heating_fuel
45
45
  xpath(%w[Water-Fuel-Type])
46
46
  end
47
+
48
+ def total_roof_area
49
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
50
+ return nil if roofs.count == 0
51
+
52
+ total_roof_area = 0
53
+ roofs.each do |roof|
54
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
55
+ total_roof_area += roof_area
56
+ end
57
+ total_roof_area
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -44,6 +44,18 @@ module ViewModel
44
44
  def water_heating_fuel
45
45
  xpath(%w[Water-Fuel-Type])
46
46
  end
47
+
48
+ def total_roof_area
49
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
50
+ return nil if roofs.count == 0
51
+
52
+ total_roof_area = 0
53
+ roofs.each do |roof|
54
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
55
+ total_roof_area += roof_area
56
+ end
57
+ total_roof_area
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -44,6 +44,18 @@ module ViewModel
44
44
  def water_heating_fuel
45
45
  xpath(%w[Water-Fuel-Type])
46
46
  end
47
+
48
+ def total_roof_area
49
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
50
+ return nil if roofs.count == 0
51
+
52
+ total_roof_area = 0
53
+ roofs.each do |roof|
54
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
55
+ total_roof_area += roof_area
56
+ end
57
+ total_roof_area
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -44,6 +44,18 @@ module ViewModel
44
44
  def water_heating_fuel
45
45
  xpath(%w[Water-Fuel-Type])
46
46
  end
47
+
48
+ def total_roof_area
49
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
50
+ return nil if roofs.count == 0
51
+
52
+ total_roof_area = 0
53
+ roofs.each do |roof|
54
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
55
+ total_roof_area += roof_area
56
+ end
57
+ total_roof_area
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -44,6 +44,18 @@ module ViewModel
44
44
  def water_heating_fuel
45
45
  xpath(%w[Water-Fuel-Type])
46
46
  end
47
+
48
+ def total_roof_area
49
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
50
+ return nil if roofs.count == 0
51
+
52
+ total_roof_area = 0
53
+ roofs.each do |roof|
54
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
55
+ total_roof_area += roof_area
56
+ end
57
+ total_roof_area
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -44,6 +44,18 @@ module ViewModel
44
44
  def water_heating_fuel
45
45
  xpath(%w[Water-Fuel-Type])
46
46
  end
47
+
48
+ def total_roof_area
49
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
50
+ return nil if roofs.count == 0
51
+
52
+ total_roof_area = 0
53
+ roofs.each do |roof|
54
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
55
+ total_roof_area += roof_area
56
+ end
57
+ total_roof_area
58
+ end
47
59
  end
48
60
  end
49
61
  end
@@ -53,6 +53,18 @@ module ViewModel
53
53
  def water_heating_fuel
54
54
  xpath(%w[Water-Fuel-Type])
55
55
  end
56
+
57
+ def total_roof_area
58
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
59
+ return nil if roofs.count == 0
60
+
61
+ total_roof_area = 0
62
+ roofs.each do |roof|
63
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
64
+ total_roof_area += roof_area
65
+ end
66
+ total_roof_area
67
+ end
56
68
  end
57
69
  end
58
70
  end
@@ -53,6 +53,18 @@ module ViewModel
53
53
  def water_heating_fuel
54
54
  xpath(%w[Water-Fuel-Type])
55
55
  end
56
+
57
+ def total_roof_area
58
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
59
+ return nil if roofs.count == 0
60
+
61
+ total_roof_area = 0
62
+ roofs.each do |roof|
63
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
64
+ total_roof_area += roof_area
65
+ end
66
+ total_roof_area
67
+ end
56
68
  end
57
69
  end
58
70
  end
@@ -53,6 +53,18 @@ module ViewModel
53
53
  def water_heating_fuel
54
54
  xpath(%w[Water-Fuel-Type])
55
55
  end
56
+
57
+ def total_roof_area
58
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
59
+ return nil if roofs.count == 0
60
+
61
+ total_roof_area = 0
62
+ roofs.each do |roof|
63
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
64
+ total_roof_area += roof_area
65
+ end
66
+ total_roof_area
67
+ end
56
68
  end
57
69
  end
58
70
  end
@@ -53,6 +53,18 @@ module ViewModel
53
53
  def water_heating_fuel
54
54
  xpath(%w[Water-Fuel-Type])
55
55
  end
56
+
57
+ def total_roof_area
58
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
59
+ return nil if roofs.count == 0
60
+
61
+ total_roof_area = 0
62
+ roofs.each do |roof|
63
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
64
+ total_roof_area += roof_area
65
+ end
66
+ total_roof_area
67
+ end
56
68
  end
57
69
  end
58
70
  end
@@ -180,6 +180,18 @@ module ViewModel
180
180
  xpath(%w[Property-Summary Total-Floor-Area])
181
181
  end
182
182
 
183
+ def total_roof_area
184
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
185
+ return nil if roofs.count == 0
186
+
187
+ total_roof_area = 0
188
+ roofs.each do |roof|
189
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
190
+ total_roof_area += roof_area
191
+ end
192
+ total_roof_area
193
+ end
194
+
183
195
  def dwelling_type
184
196
  xpath(%w[Dwelling-Type])
185
197
  end
@@ -180,6 +180,18 @@ module ViewModel
180
180
  xpath(%w[Property-Summary Total-Floor-Area])
181
181
  end
182
182
 
183
+ def total_roof_area
184
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
185
+ return nil if roofs.count == 0
186
+
187
+ total_roof_area = 0
188
+ roofs.each do |roof|
189
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
190
+ total_roof_area += roof_area
191
+ end
192
+ total_roof_area
193
+ end
194
+
183
195
  def dwelling_type
184
196
  xpath(%w[Dwelling-Type])
185
197
  end
@@ -182,6 +182,18 @@ module ViewModel
182
182
  xpath(%w[Property-Summary Total-Floor-Area])
183
183
  end
184
184
 
185
+ def total_roof_area
186
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
187
+ return nil if roofs.count == 0
188
+
189
+ total_roof_area = 0
190
+ roofs.each do |roof|
191
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
192
+ total_roof_area += roof_area
193
+ end
194
+ total_roof_area
195
+ end
196
+
185
197
  def dwelling_type
186
198
  xpath(%w[Dwelling-Type])
187
199
  end
@@ -184,6 +184,18 @@ module ViewModel
184
184
  xpath(%w[Property-Summary Total-Floor-Area]).to_i
185
185
  end
186
186
 
187
+ def total_roof_area
188
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
189
+ return nil if roofs.count == 0
190
+
191
+ total_roof_area = 0
192
+ roofs.each do |roof|
193
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
194
+ total_roof_area += roof_area
195
+ end
196
+ total_roof_area
197
+ end
198
+
187
199
  def dwelling_type
188
200
  xpath(%w[Dwelling-Type])
189
201
  end
@@ -184,6 +184,18 @@ module ViewModel
184
184
  xpath(%w[Property-Summary Total-Floor-Area]).to_i
185
185
  end
186
186
 
187
+ def total_roof_area
188
+ roofs = @xml_doc.xpath("//SAP-Roofs/SAP-Roof")
189
+ return nil if roofs.count == 0
190
+
191
+ total_roof_area = 0
192
+ roofs.each do |roof|
193
+ roof_area = roof.at("Total-Roof-Area")&.content.to_i
194
+ total_roof_area += roof_area
195
+ end
196
+ total_roof_area
197
+ end
198
+
187
199
  def dwelling_type
188
200
  xpath(%w[Dwelling-Type])
189
201
  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: 1.1.2
4
+ version: 1.1.4
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: 2023-07-18 00:00:00.000000000 Z
11
+ date: 2023-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -1884,7 +1884,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1884
1884
  - !ruby/object:Gem::Version
1885
1885
  version: '0'
1886
1886
  requirements: []
1887
- rubygems_version: 3.3.26
1887
+ rubygems_version: 3.3.7
1888
1888
  signing_key:
1889
1889
  specification_version: 4
1890
1890
  summary: Library used to parse Energy Performance Certificates (EPC)