epb_view_models 2.0.18 → 2.0.20

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: 12b9bc4e145892c1084d6124b37e06a48b18f5e4f19469c3339925306b20a7a2
4
- data.tar.gz: 3e2b52c53637be8e89a9da65f0d08d0c7e917e81f894d4cce3ad4ea71599a3f3
3
+ metadata.gz: 9907c3bbfc0deee1802164bdb0be33ff7b1a72d6158962b9a7d647b4d70b3cd7
4
+ data.tar.gz: 49b6df150a4c8ea0e5e88b68ffdacf4e93a62ddd7b12f01d6f245057056d5b62
5
5
  SHA512:
6
- metadata.gz: f84c4bb41fca78ad62e36ffa1c6e28230e185baf664119c97d1f112f9c105a53db09980a578894f2290d80e5fd74c23c2ea2ce04755c4245fb284b056e3e2599
7
- data.tar.gz: 6b2b72411f94c6f87221398f084eacc603421e95a2204747623926212dfbf1842685c47db489c0fcdcc2c221f923c3d223a71a8291fe6d4177d98ba0872e82e2
6
+ metadata.gz: 3e68bbb919f2eef1f852726f496d9c119763598dc94a8cdef7524364b375acfd8b5664c48bb8409e7a1dc25ed05758cd887976108a50c1c4858a952cda1762b7
7
+ data.tar.gz: 0a4381990244e6796e7a1bb8b9671cdc820582b0b0c81569f4cebaabddda9426decc7dfe79095fad618b89c49a575b4b1dd200837e8162a8e850f9d41a661313
@@ -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.18"
8
+ VERSION = "2.0.20"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -1,12 +1,12 @@
1
1
  module ViewModel
2
2
  module CepcS71
3
3
  class Cepc < ViewModel::Cepc71::CommonSchema
4
-
5
4
  def date_of_expiry
6
5
  expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10
7
6
 
8
7
  expires_at.to_s
9
8
  end
9
+
10
10
  def ac_inspection_commissioned
11
11
  xpath(%w[AC-Inspection-Commissioned])
12
12
  end
@@ -125,8 +125,8 @@ module ViewModel
125
125
  {
126
126
  sequence: xpath(%w[Sequence], node).to_i,
127
127
  improvement_code: xpath(%w[Improvement-Details Improvement-Number], node),
128
- improvement_summary: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-20.0.0", improvement_number: improvement_code).summary : xpath(%w[Improvement-Summary], node),
129
- improvement_description: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-20.0.0", improvement_number: improvement_code).description : xpath(%w[Improvement-Description], node),
128
+ improvement_summary: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-21.0.0", improvement_number: improvement_code).summary : xpath(%w[Improvement-Summary], node),
129
+ improvement_description: improvement_code ? accessor.fetch_details(schema_version: "RdSAP-Schema-21.0.0", improvement_number: improvement_code).description : xpath(%w[Improvement-Description], node),
130
130
  indicative_cost: xpath(%w[Indicative-Cost], node),
131
131
  }
132
132
  end
@@ -397,6 +397,37 @@ module ViewModel
397
397
  xpath(%w[Heated-Room-Count])&.to_i
398
398
  end
399
399
 
400
+ def low_energy_lighting
401
+ (low_energy_fixed_lighting_outlets_count / fixed_lighting_outlets_count) * 100
402
+ end
403
+
404
+ def fixed_lighting_outlets_count
405
+ 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
408
+ end
409
+ fixed_lighting_outlets_count
410
+ end
411
+
412
+ def low_energy_fixed_lighting_outlets_count
413
+ low_energy_fixed_lighting_outlets_count = 0
414
+ if xpath(%w[CFL-Fixed-Lighting-Bulbs-Count])
415
+ low_energy_fixed_lighting_outlets_count += xpath(%w[CFL-Fixed-Lighting-Bulbs-Count])&.to_i
416
+ end
417
+ if xpath(%w[LED-Fixed-Lighting-Bulbs-Count])
418
+ low_energy_fixed_lighting_outlets_count += xpath(%w[LED-Fixed-Lighting-Bulbs-Count])&.to_i
419
+ end
420
+ if xpath(%w[Low-Energy-Fixed-Lighting-Bulbs-Count])
421
+ low_energy_fixed_lighting_outlets_count += xpath(%w[Low-Energy-Fixed-Lighting-Bulbs-Count])&.to_i
422
+ end
423
+
424
+ low_energy_fixed_lighting_outlets_count
425
+ end
426
+
427
+ def open_fireplaces_count
428
+ xpath(%w[Open-Chimneys-Count])&.to_i
429
+ end
430
+
400
431
  def hot_water_description
401
432
  xpath(%w[Hot-Water Description])
402
433
  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.18
4
+ version: 2.0.20
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: 2025-05-19 00:00:00.000000000 Z
11
+ date: 2025-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri