epb_view_models 2.2.12 → 2.2.14

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: ff10125eacd9b91fc1954def6349f5f94afd5f3066a066c0346fa14628fc2ead
4
- data.tar.gz: f0076f0b3a96328121efa7884f2d6e229b76fc477accfa505f32bde80edcdbf1
3
+ metadata.gz: 75e967a3adf0402bc42780fee8db05794e1c5aec0bde4d5a06ab642d946def10
4
+ data.tar.gz: cca7f31cf0268b164d693f02b92e0cb129d6e09de0e61b44778ea7d656763a58
5
5
  SHA512:
6
- metadata.gz: 355767e1ec7327969f5e913d211602f28199919c9f4446a543091c400069c93ce0ecdfdd7d4a283df41cd2536ccba7f0ec44b05fddac9655f837e2100d49de5d
7
- data.tar.gz: 2bfbc39036bc745c0617f327927061904398dffcd566192a2bfa8f4c9bd72530a2aab91be66b04ea71626e04b3ac0fab666c7188bdfa3e8ea83367df2e07007b
6
+ metadata.gz: 05dd97560b0132e8cc85254611902bd46803590b75650a262724c072a503ebda5a4383dfb456aefcfbfcb96a0d3ab163a85c0f18e514ca8874796690047c0c68
7
+ data.tar.gz: d650e82077611f64bb5f518ce219ed308614e1a9c250b013e5d5294f58db3deadc1d4cd62836941d125a6f098a6d937f4326d69f98fa23e8fce5ec364bd39ad8
@@ -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.2.12"
8
+ VERSION = "2.2.14"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -171,6 +171,14 @@ module ViewModel
171
171
  def insurer_pi_limit
172
172
  xpath(%w[PI-Limit])
173
173
  end
174
+
175
+ def inspection_date
176
+ xpath(%w[Inspection-Date])
177
+ end
178
+
179
+ def completion_date
180
+ xpath(%w[Completion-Date])
181
+ end
174
182
  end
175
183
  end
176
184
  end
@@ -53,6 +53,10 @@ module ViewModel
53
53
  xpath(%w[Registration-Date])
54
54
  end
55
55
 
56
+ def date_of_completion
57
+ xpath(%w[Completion-Date])
58
+ end
59
+
56
60
  def address_id
57
61
  "LPRN-#{xpath(%w[UPRN])}"
58
62
  end
@@ -528,6 +532,130 @@ module ViewModel
528
532
  def has_cylinder_thermostat
529
533
  xpath(%w[Cylinder-Thermostat])
530
534
  end
535
+
536
+ def party_wall_construction
537
+ xpath(%w[SAP-Building-Part Party-Wall-Construction])
538
+ end
539
+
540
+ # For lodgement rules
541
+
542
+ def party_walls_construction
543
+ @xml_doc
544
+ .search("SAP-Building-Part")
545
+ .map do |node|
546
+ xpath(%w[Party-Wall-Construction], node)
547
+ end
548
+ end
549
+
550
+ def walls_thickness
551
+ @xml_doc
552
+ .search("SAP-Building-Part")
553
+ .map do |node|
554
+ {
555
+ alternative_wall_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness")&.content,
556
+ alternative_wall_thickness_measured: node.at_xpath("SAP-Alternative-Wall/Wall-Thickness-Measured")&.content,
557
+ alternative_wall_construction: node.at_xpath("SAP-Alternative-Wall/Wall-Construction")&.content,
558
+ alternative_wall_u_value: node.at_xpath("SAP-Alternative-Wall/Wall-U-Value")&.content,
559
+ alternative_wall_insulation_thickness: node.at_xpath("SAP-Alternative-Wall/Wall-Insulation-Thickness")&.content,
560
+ wall_thickness: node.at_xpath("Wall-Thickness")&.content,
561
+ wall_construction: node.at_xpath("Wall-Construction")&.content,
562
+ wall_thickness_measured: node.at_xpath("Wall-Thickness-Measured")&.content,
563
+ }
564
+ end
565
+ end
566
+
567
+ def rooves_construction_and_insulation
568
+ @xml_doc
569
+ .search("SAP-Building-Part")
570
+ .map do |node|
571
+ {
572
+ roof_insulation_location: node.at_xpath("Roof-Insulation-Location")&.content,
573
+ roof_construction: node.at_xpath("Roof-Construction")&.content,
574
+ }
575
+ end
576
+ end
577
+
578
+ def rooms_in_roof_insulation
579
+ @xml_doc
580
+ .search("SAP-Building-Part")
581
+ .map do |node|
582
+ xpath(%w[SAP-Room-In-Roof Insulation])
583
+ end
584
+ end
585
+
586
+ def floors_insulation
587
+ @xml_doc
588
+ .search("SAP-Building-Part")
589
+ .map do |node|
590
+ {
591
+ floor_u_value: node.at_xpath("Floor-U-Value")&.content,
592
+ floor_insulation_thickness: node.at_xpath("Floor-Insulation-Thickness")&.content,
593
+ }
594
+ end
595
+ end
596
+
597
+ def rooves_insulation
598
+ @xml_doc
599
+ .search("SAP-Building-Part")
600
+ .map do |node|
601
+ {
602
+ roof_u_value: node.at_xpath("Roof-U-Value")&.content,
603
+ roof_insulation_thickness: node.at_xpath("Roof-Insulation-Thickness")&.content,
604
+ rafter_insulation_thickness: node.at_xpath("Rafter-Insulation-Thickness")&.content,
605
+ flat_roof_insulation_thickness: node.at_xpath("Flat-Roof-Insulation-Thickness")&.content,
606
+ sloping_ceiling_insulation_thickness: node.at_xpath("Sloping-Ceiling-Insulation-Thickness")&.content,
607
+ }
608
+ end
609
+ end
610
+
611
+ def walls_insulation
612
+ @xml_doc
613
+ .search("SAP-Building-Part")
614
+ .map do |node|
615
+ {
616
+ wall_u_value: node.at_xpath("Wall-U-Value")&.content,
617
+ wall_insulation_thickness: node.at_xpath("Wall-Insulation-Thickness")&.content,
618
+ }
619
+ end
620
+ end
621
+
622
+ def rooms_in_roof
623
+ @xml_doc
624
+ .search("SAP-Building-Part")
625
+ .map do |node|
626
+ node.at_xpath("SAP-Room-In-Roof")&.content.to_s
627
+ end
628
+ end
629
+
630
+ def rooms_in_roof_roof_insulation
631
+ @xml_doc
632
+ .search("SAP-Building-Part")
633
+ .map do |node|
634
+ {
635
+ roof_insulation_thickness: xpath(%w[SAP-Room-In-Roof Roof-Insulation-Thickness]),
636
+ room_in_roof_details: xpath(%w[SAP-Room-In-Roof Room-In-Roof-Details]),
637
+ }
638
+ end
639
+ end
640
+
641
+ def main_heating_details
642
+ @xml_doc
643
+ .search("Main-Heating")
644
+ .map do |node|
645
+ {
646
+ main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
647
+ sap_main_heating_code: xpath(%w[SAP-Main-Heating-Code]),
648
+ main_fuel_type: xpath(%w[Main-Fuel-Type]),
649
+ }
650
+ end
651
+ end
652
+
653
+ def water_heating
654
+ {
655
+ water_heating_fuel: xpath(%w[Water-Heating-Fuel]),
656
+ water_heating_code: xpath(%w[Water-Heating-Code]),
657
+ }
658
+ end
531
659
  end
532
660
  end
533
661
  end
@@ -595,6 +595,29 @@ module ViewModel
595
595
  def electricity_smart_meter_present
596
596
  Helper::ToBool.execute(xpath(%w[Electricity-Smart-Meter-Present]))
597
597
  end
598
+
599
+ def date_of_completion
600
+ xpath(%w[Completion-Date])
601
+ end
602
+
603
+ def main_heating_types
604
+ @xml_doc
605
+ .search("SAP-Heating/Main-Heating-Details/Main-Heating")
606
+ .map do |node|
607
+ {
608
+ main_heating_code: xpath(%w[Main-Heating-Code]),
609
+ main_heating_index_number: xpath(%w[Main-Heating-Index-Number]),
610
+ }
611
+ end
612
+ end
613
+
614
+ def construction_years
615
+ @xml_doc
616
+ .search("SAP-Building-Part")
617
+ .map do |node|
618
+ xpath(%w[Construction-Year], node)
619
+ end
620
+ end
598
621
  end
599
622
  end
600
623
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epb_view_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.12
4
+ version: 2.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - MHCLG Energy Performance of Buildings