epb_view_models 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52ca0b0fddb4063f84183fbc706a463c4c50094811624ca23297ffa7e91ef612
4
- data.tar.gz: 338993e9e0b7cbf6f4fd9dff9f80345631972ec4a01329a978ba3b012b6b6dba
3
+ metadata.gz: 8eabee1c7bfdbe1bf088b218d9b2ac1f730810a790bfd84266255855668fa80f
4
+ data.tar.gz: 8969240277cfe72cbee1e1ff39f9e4b6fe8145daca3bf8f15af9f8c004766333
5
5
  SHA512:
6
- metadata.gz: c0a0e4185291d3eef3d87e91db97157e7654ca85d2acb6d908d57f620f64ebfe4e012fdc02ee9a1c1cd1feccdf6e66dfd424885c2d922269b9a89e84514fc58e
7
- data.tar.gz: 023c03bfb0cdb1c079861e6e6f723dac281a8a1d3d474b4ab69c1de3a3d5afbac22f88ea2552917bc27edb51615aa248cbc4c4f3c2d8ff5188eb705eaebc2e5e
6
+ metadata.gz: 7d4eb10d848147f8039a7171a598f03f183c5cc4f8348ce587ce652e86859d1831427ff1dbda4819e938d9a6a3f081e4a90a2b2edb07b9efe2748d2517fc6ae8
7
+ data.tar.gz: 21eb8a3a148862f30be675a623e082ae8064570391b76dbaad076da7e4b79860bb854ba5559fd35844e90ca6731d7566e68bd82058f4789fd16b6b618e7edea4
@@ -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.3"
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.3
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-21 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)