epb_view_models 2.1.0 → 2.1.2
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/Gemfile.lock +56 -46
- data/lib/epb_view_models.rb +3 -3
- data/lib/helper/ac_report_extraction.rb +6 -6
- data/lib/presenter/xml/parser.rb +1 -1
- data/lib/view_model/rd_sap_schema_210/common_schema.rb +7 -3
- data/lib/view_model/rd_sap_schema_2101/common_schema.rb +7 -3
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a46d5ef3eeaf4b588d737556a15d5b96dfaca90e116bf26c8476ac6c9f5db7a
|
4
|
+
data.tar.gz: e1b45d08b8d1486d87ae89d1bd410d8fa7689f1fe960cd39a84aa0737ad6eabc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eab33a7af9f0756103ce2b75d47de89ebc62b33f7f12b691110287ab94aa1d63d18e991ad4520e911f251d51049cb3bd92cfffb9be1ffb676dd6073d90e9fa2
|
7
|
+
data.tar.gz: bab7fdbaa0b7fef17597a5c421437e04ba7621cc7c73e8dd0bc32d5e675e67c1df9b2bf578d3ab85fceac946541d276bde769a09dafe3da702a3594f5a6c4b84
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (8.0.
|
4
|
+
activesupport (8.0.2)
|
5
5
|
base64
|
6
6
|
benchmark (>= 0.3)
|
7
7
|
bigdecimal
|
@@ -14,75 +14,85 @@ GEM
|
|
14
14
|
securerandom (>= 0.3)
|
15
15
|
tzinfo (~> 2.0, >= 2.0.5)
|
16
16
|
uri (>= 0.13.1)
|
17
|
-
ast (2.4.
|
18
|
-
base64 (0.
|
19
|
-
benchmark (0.4.
|
20
|
-
bigdecimal (3.
|
17
|
+
ast (2.4.3)
|
18
|
+
base64 (0.3.0)
|
19
|
+
benchmark (0.4.1)
|
20
|
+
bigdecimal (3.2.2)
|
21
21
|
concurrent-ruby (1.3.5)
|
22
|
-
connection_pool (2.5.
|
23
|
-
diff-lcs (1.
|
24
|
-
drb (2.2.
|
22
|
+
connection_pool (2.5.3)
|
23
|
+
diff-lcs (1.6.2)
|
24
|
+
drb (2.2.3)
|
25
25
|
i18n (1.14.7)
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
|
-
json (2.
|
28
|
-
language_server-protocol (3.17.0.
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
json (2.12.2)
|
28
|
+
language_server-protocol (3.17.0.5)
|
29
|
+
lint_roller (1.1.0)
|
30
|
+
logger (1.7.0)
|
31
|
+
mini_portile2 (2.8.9)
|
32
|
+
minitest (5.25.5)
|
33
|
+
nokogiri (1.18.8)
|
34
|
+
mini_portile2 (~> 2.8.2)
|
32
35
|
racc (~> 1.4)
|
33
|
-
parallel (1.
|
34
|
-
parser (3.3.
|
36
|
+
parallel (1.27.0)
|
37
|
+
parser (3.3.8.0)
|
35
38
|
ast (~> 2.4.1)
|
36
39
|
racc
|
37
|
-
|
38
|
-
|
40
|
+
prism (1.4.0)
|
41
|
+
racc (1.8.1)
|
42
|
+
rack (3.1.16)
|
39
43
|
rainbow (3.1.1)
|
40
44
|
rake (13.0.6)
|
41
45
|
regexp_parser (2.10.0)
|
42
|
-
rexml (3.4.
|
43
|
-
rspec (3.13.
|
46
|
+
rexml (3.4.1)
|
47
|
+
rspec (3.13.1)
|
44
48
|
rspec-core (~> 3.13.0)
|
45
49
|
rspec-expectations (~> 3.13.0)
|
46
50
|
rspec-mocks (~> 3.13.0)
|
47
|
-
rspec-core (3.13.
|
51
|
+
rspec-core (3.13.4)
|
48
52
|
rspec-support (~> 3.13.0)
|
49
|
-
rspec-expectations (3.13.
|
53
|
+
rspec-expectations (3.13.5)
|
50
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
55
|
rspec-support (~> 3.13.0)
|
52
|
-
rspec-mocks (3.13.
|
56
|
+
rspec-mocks (3.13.5)
|
53
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
58
|
rspec-support (~> 3.13.0)
|
55
|
-
rspec-support (3.13.
|
56
|
-
rubocop (1.
|
59
|
+
rspec-support (3.13.4)
|
60
|
+
rubocop (1.76.2)
|
57
61
|
json (~> 2.3)
|
58
|
-
language_server-protocol (
|
62
|
+
language_server-protocol (~> 3.17.0.2)
|
63
|
+
lint_roller (~> 1.1.0)
|
59
64
|
parallel (~> 1.10)
|
60
65
|
parser (>= 3.3.0.2)
|
61
66
|
rainbow (>= 2.2.2, < 4.0)
|
62
67
|
regexp_parser (>= 2.9.3, < 3.0)
|
63
|
-
rubocop-ast (>= 1.
|
68
|
+
rubocop-ast (>= 1.45.1, < 2.0)
|
64
69
|
ruby-progressbar (~> 1.7)
|
65
70
|
unicode-display_width (>= 2.4.0, < 4.0)
|
66
|
-
rubocop-ast (1.
|
67
|
-
parser (>= 3.3.
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
rubocop (
|
72
|
-
|
73
|
-
rubocop
|
74
|
-
rubocop-
|
75
|
-
rubocop-
|
76
|
-
rubocop-
|
77
|
-
|
71
|
+
rubocop-ast (1.45.1)
|
72
|
+
parser (>= 3.3.7.2)
|
73
|
+
prism (~> 1.4)
|
74
|
+
rubocop-capybara (2.22.1)
|
75
|
+
lint_roller (~> 1.1)
|
76
|
+
rubocop (~> 1.72, >= 1.72.1)
|
77
|
+
rubocop-govuk (5.1.15)
|
78
|
+
rubocop (= 1.76.2)
|
79
|
+
rubocop-ast (= 1.45.1)
|
80
|
+
rubocop-capybara (= 2.22.1)
|
81
|
+
rubocop-rails (= 2.32.0)
|
82
|
+
rubocop-rake (= 0.7.1)
|
83
|
+
rubocop-rspec (= 3.6.0)
|
84
|
+
rubocop-rails (2.32.0)
|
78
85
|
activesupport (>= 4.2.0)
|
86
|
+
lint_roller (~> 1.1)
|
79
87
|
rack (>= 1.1)
|
80
|
-
rubocop (>= 1.
|
81
|
-
rubocop-ast (>= 1.
|
82
|
-
rubocop-rake (0.
|
83
|
-
|
84
|
-
|
85
|
-
|
88
|
+
rubocop (>= 1.75.0, < 2.0)
|
89
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
90
|
+
rubocop-rake (0.7.1)
|
91
|
+
lint_roller (~> 1.1)
|
92
|
+
rubocop (>= 1.72.1)
|
93
|
+
rubocop-rspec (3.6.0)
|
94
|
+
lint_roller (~> 1.1)
|
95
|
+
rubocop (~> 1.72, >= 1.72.1)
|
86
96
|
ruby-progressbar (1.13.0)
|
87
97
|
securerandom (0.4.1)
|
88
98
|
tzinfo (2.0.6)
|
@@ -90,8 +100,8 @@ GEM
|
|
90
100
|
unicode-display_width (3.1.4)
|
91
101
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
92
102
|
unicode-emoji (4.0.4)
|
93
|
-
uri (1.0.
|
94
|
-
zeitwerk (2.
|
103
|
+
uri (1.0.3)
|
104
|
+
zeitwerk (2.7.3)
|
95
105
|
|
96
106
|
PLATFORMS
|
97
107
|
ruby
|
data/lib/epb_view_models.rb
CHANGED
@@ -5,15 +5,15 @@ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
|
|
5
5
|
loader.setup
|
6
6
|
|
7
7
|
module EpbViewModels
|
8
|
-
VERSION = "2.1.
|
8
|
+
VERSION = "2.1.2"
|
9
9
|
end
|
10
10
|
|
11
11
|
# Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
|
12
12
|
# Source: http://jeffgardner.org/2011/08/04/rails-string-to-boolean-method/
|
13
13
|
class String
|
14
14
|
def to_bool
|
15
|
-
return true if self == true || self =~
|
16
|
-
return false if self == false || blank? || self =~
|
15
|
+
return true if self == true || self =~ /(true|t|yes|y|1)$/i
|
16
|
+
return false if self == false || blank? || self =~ /(false|f|no|n|0)$/i
|
17
17
|
|
18
18
|
raise ArgumentError, "invalid value for Boolean: \"#{self}\""
|
19
19
|
end
|
@@ -104,7 +104,7 @@ module Helper
|
|
104
104
|
xpath(%w[ACI-Cooling-Plant-Refrigeration/Refrigerant-Name], node),
|
105
105
|
f_gas_inspection:
|
106
106
|
checklist_values_with_guidance(node.at("ACI-Cooling-Plant-Refrigeration"))[
|
107
|
-
:f_gas_inspection
|
107
|
+
:f_gas_inspection,
|
108
108
|
],
|
109
109
|
pre_compressor:
|
110
110
|
xpath(%w[ACI-Cooling-Plant-Refrigeration/Pre-Compressor], node),
|
@@ -118,11 +118,11 @@ module Helper
|
|
118
118
|
),
|
119
119
|
compressor_control:
|
120
120
|
checklist_values(node.at("ACI-Cooling-Plant-Refrigeration"), skip_state: true)[
|
121
|
-
:compressor_control
|
121
|
+
:compressor_control,
|
122
122
|
],
|
123
123
|
refrigerant_leak:
|
124
124
|
checklist_values(node.at("ACI-Cooling-Plant-Refrigeration"))[
|
125
|
-
:refrigerant_leak
|
125
|
+
:refrigerant_leak,
|
126
126
|
],
|
127
127
|
guidance:
|
128
128
|
guidance(node.at("ACI-Cooling-Plant-Refrigeration/Guidance")),
|
@@ -130,11 +130,11 @@ module Helper
|
|
130
130
|
maintenance: {
|
131
131
|
records_kept:
|
132
132
|
checklist_values(node.at("ACI-Cooling-Plant-Maintenance"))[
|
133
|
-
:records_kept
|
133
|
+
:records_kept,
|
134
134
|
],
|
135
135
|
competent_person:
|
136
136
|
checklist_values(node.at("ACI-Cooling-Plant-Maintenance"))[
|
137
|
-
:competent_person
|
137
|
+
:competent_person,
|
138
138
|
],
|
139
139
|
guidance: guidance(node.at("ACI-Cooling-Plant-Maintenance/Guidance")),
|
140
140
|
},
|
@@ -146,7 +146,7 @@ module Helper
|
|
146
146
|
},
|
147
147
|
humidity_control:
|
148
148
|
checklist_values(node.at("ACI-Cooling-Plant-Humidity-Control"))[
|
149
|
-
:humidity_control
|
149
|
+
:humidity_control,
|
150
150
|
],
|
151
151
|
chillers:
|
152
152
|
if xpath(%w[ACI-Cooling-Plant-Chillers], node).nil?
|
data/lib/presenter/xml/parser.rb
CHANGED
@@ -153,7 +153,7 @@ module Presenter
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def is_bool?(string)
|
156
|
-
string == true || string == false || string =~
|
156
|
+
string == true || string == false || string =~ /(true|false)$/i ? true : false
|
157
157
|
end
|
158
158
|
|
159
159
|
def try_as_number(string)
|
@@ -398,13 +398,17 @@ module ViewModel
|
|
398
398
|
end
|
399
399
|
|
400
400
|
def low_energy_lighting
|
401
|
-
|
401
|
+
if fixed_lighting_outlets_count.zero?
|
402
|
+
return 0
|
403
|
+
end
|
404
|
+
|
405
|
+
((low_energy_fixed_lighting_outlets_count.to_f / fixed_lighting_outlets_count) * 100).round
|
402
406
|
end
|
403
407
|
|
404
408
|
def fixed_lighting_outlets_count
|
405
409
|
fixed_lighting_outlets_count = low_energy_fixed_lighting_outlets_count
|
406
|
-
if xpath(%w[Incandescent-Lighting-Bulbs-Count])
|
407
|
-
fixed_lighting_outlets_count += xpath(%w[Incandescent-Lighting-Bulbs-Count])&.to_i
|
410
|
+
if xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])
|
411
|
+
fixed_lighting_outlets_count += xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])&.to_i
|
408
412
|
end
|
409
413
|
fixed_lighting_outlets_count
|
410
414
|
end
|
@@ -398,13 +398,17 @@ module ViewModel
|
|
398
398
|
end
|
399
399
|
|
400
400
|
def low_energy_lighting
|
401
|
-
|
401
|
+
if fixed_lighting_outlets_count.zero?
|
402
|
+
return 0
|
403
|
+
end
|
404
|
+
|
405
|
+
((low_energy_fixed_lighting_outlets_count.to_f / fixed_lighting_outlets_count) * 100).round
|
402
406
|
end
|
403
407
|
|
404
408
|
def fixed_lighting_outlets_count
|
405
409
|
fixed_lighting_outlets_count = low_energy_fixed_lighting_outlets_count
|
406
|
-
if xpath(%w[Incandescent-Lighting-Bulbs-Count])
|
407
|
-
fixed_lighting_outlets_count += xpath(%w[Incandescent-Lighting-Bulbs-Count])&.to_i
|
410
|
+
if xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])
|
411
|
+
fixed_lighting_outlets_count += xpath(%w[Incandescent-Fixed-Lighting-Bulbs-Count])&.to_i
|
408
412
|
end
|
409
413
|
fixed_lighting_outlets_count
|
410
414
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epb_view_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MHCLG Energy Performance of Buildings
|
8
|
+
autorequire:
|
8
9
|
bindir: exe
|
9
10
|
cert_chain: []
|
10
|
-
date:
|
11
|
+
date: 2025-07-07 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: nokogiri
|
@@ -37,6 +38,7 @@ dependencies:
|
|
37
38
|
- - "~>"
|
38
39
|
- !ruby/object:Gem::Version
|
39
40
|
version: '2.6'
|
41
|
+
description:
|
40
42
|
email:
|
41
43
|
- mhclg.digital-services@levellingup.gov.uk
|
42
44
|
executables: []
|
@@ -1948,6 +1950,7 @@ homepage: https://github.com/communitiesuk/epb-view-models
|
|
1948
1950
|
licenses:
|
1949
1951
|
- MIT
|
1950
1952
|
metadata: {}
|
1953
|
+
post_install_message:
|
1951
1954
|
rdoc_options: []
|
1952
1955
|
require_paths:
|
1953
1956
|
- lib
|
@@ -1962,7 +1965,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1962
1965
|
- !ruby/object:Gem::Version
|
1963
1966
|
version: '0'
|
1964
1967
|
requirements: []
|
1965
|
-
rubygems_version: 3.
|
1968
|
+
rubygems_version: 3.5.11
|
1969
|
+
signing_key:
|
1966
1970
|
specification_version: 4
|
1967
1971
|
summary: Library used to parse Energy Performance Certificates (EPC)
|
1968
1972
|
test_files: []
|