epb_view_models 2.2.8 → 2.2.9

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: 16da8cae15a386de01bf94c989ce5e4ca51d4375091ae6034532e67c773491f3
4
- data.tar.gz: c603a92a2aba0de6684fb4d9a4715f9d8055344c9cc459e04618e5c5bcade888
3
+ metadata.gz: 2dcf0bbef8d6df145835428d355332d1141ef5d323e554c1f40d77410d4019df
4
+ data.tar.gz: ff5bad3db382217b163b22db8163019b83159f5e415015f0d25d797297df203a
5
5
  SHA512:
6
- metadata.gz: 38b4b2b77b031aa6ae1832af198515bc66a7eb22375f76b24b739066e35ea298a6f1ae397a5b32d0478fe09e00a73e20a3ca44ce5ca837b5e29720dc1cc50c32
7
- data.tar.gz: 398a8e5284f2d7097781bad7593d75023634cf400f067b1cc861b9d784e9758a9aac2268af5b9bc30af2b92b01d11949b467ecc02b9cef51db9be5fa87fe1a5e
6
+ metadata.gz: 4872046aef2084c409a287985a00513bbc982255012213f526a750e88e55fc6161e35694b5745b8a4035337a883360db3608d35514ca0a9b158c1b6eac75d09a
7
+ data.tar.gz: 5f2fc8ac67ad081a2069a636f98e81e84ccbc008d664e838210535a21be73a039a9dc634a12a2c9bfd6874526fee7fb76bd9539946b6b94357bbf49aac1e78cf
@@ -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.8"
8
+ VERSION = "2.2.9"
9
9
  end
10
10
 
11
11
  # Monkey patching to avoid using ActiveRecord::Type::Boolean.new.cast
@@ -39,8 +39,7 @@ module Presenter
39
39
  address: @view_model.assessor_contact_address,
40
40
  },
41
41
  },
42
- current_carbon_emission:
43
- convert_to_big_decimal(@view_model.current_carbon_emission),
42
+ current_carbon_emission: @view_model.current_carbon_emission.to_f,
44
43
  carbon_emissions_current_per_floor_area: @view_model.co2_emissions_current_per_floor_area,
45
44
  current_energy_efficiency_band: Helper::EnergyBandCalculator.domestic(@view_model.current_energy_rating),
46
45
  current_energy_efficiency_rating: @view_model.current_energy_rating,
@@ -58,8 +57,7 @@ module Presenter
58
57
  hot_water_cost_potential: @view_model.hot_water_cost_potential,
59
58
  lighting_cost_current: @view_model.lighting_cost_current,
60
59
  lighting_cost_potential: @view_model.lighting_cost_potential,
61
- potential_carbon_emission:
62
- convert_to_big_decimal(@view_model.potential_carbon_emission),
60
+ potential_carbon_emission: @view_model.potential_carbon_emission.to_f,
63
61
  potential_energy_efficiency_band: Helper::EnergyBandCalculator.domestic(@view_model.potential_energy_rating),
64
62
  potential_energy_efficiency_rating: @view_model.potential_energy_rating,
65
63
  potential_energy_saving:
@@ -78,27 +76,17 @@ module Presenter
78
76
  end,
79
77
  lzc_energy_sources: @view_model.lzc_energy_sources,
80
78
  related_party_disclosure_number: @view_model.respond_to?(:related_party_disclosure_number) ? @view_model.related_party_disclosure_number : nil,
81
- related_party_disclosure_text:
82
- @view_model.related_party_disclosure_text,
83
- total_floor_area: convert_to_big_decimal(@view_model.total_floor_area),
79
+ related_party_disclosure_text: @view_model.related_party_disclosure_text,
80
+ total_floor_area: @view_model.total_floor_area.to_i,
84
81
  status: @view_model.status,
85
82
  environmental_impact_current: @view_model.environmental_impact_current,
86
- environmental_impact_potential:
87
- @view_model.environmental_impact_potential,
83
+ environmental_impact_potential: @view_model.environmental_impact_potential,
88
84
  primary_energy_use: @view_model.respond_to?(:primary_energy_use) ? @view_model.primary_energy_use : nil,
89
85
  addendum: @view_model.addendum,
90
86
  gas_smart_meter_present: @view_model.respond_to?(:gas_smart_meter_present) ? @view_model.gas_smart_meter_present : nil,
91
87
  electricity_smart_meter_present: @view_model.respond_to?(:electricity_smart_meter_present) ? @view_model.electricity_smart_meter_present : nil,
92
88
  }
93
89
  end
94
-
95
- private
96
-
97
- def convert_to_big_decimal(node)
98
- return "" unless node
99
-
100
- BigDecimal(node, 0)
101
- end
102
90
  end
103
91
  end
104
92
  end
@@ -36,8 +36,7 @@ module Presenter
36
36
  address: @view_model.assessor_contact_address,
37
37
  },
38
38
  },
39
- current_carbon_emission:
40
- convert_to_big_decimal(@view_model.current_carbon_emission),
39
+ current_carbon_emission: @view_model.current_carbon_emission.to_f,
41
40
  carbon_emissions_current_per_floor_area: @view_model.co2_emissions_current_per_floor_area,
42
41
  current_energy_efficiency_band: Helper::EnergyBandCalculator.domestic(@view_model.current_energy_rating),
43
42
  current_energy_efficiency_rating: @view_model.current_energy_rating,
@@ -55,8 +54,7 @@ module Presenter
55
54
  hot_water_cost_potential: @view_model.hot_water_cost_potential,
56
55
  lighting_cost_current: @view_model.lighting_cost_current,
57
56
  lighting_cost_potential: @view_model.lighting_cost_potential,
58
- potential_carbon_emission:
59
- convert_to_big_decimal(@view_model.potential_carbon_emission),
57
+ potential_carbon_emission: @view_model.potential_carbon_emission.to_f,
60
58
  potential_energy_efficiency_band: Helper::EnergyBandCalculator.domestic(@view_model.potential_energy_rating),
61
59
  potential_energy_efficiency_rating: @view_model.potential_energy_rating,
62
60
  potential_energy_saving:
@@ -75,27 +73,17 @@ module Presenter
75
73
  end,
76
74
  lzc_energy_sources: @view_model.lzc_energy_sources,
77
75
  related_party_disclosure_number: @view_model.respond_to?(:related_party_disclosure_number) ? @view_model.related_party_disclosure_number : nil,
78
- related_party_disclosure_text:
79
- @view_model.related_party_disclosure_text,
80
- total_floor_area: convert_to_big_decimal(@view_model.total_floor_area),
76
+ related_party_disclosure_text: @view_model.related_party_disclosure_text,
77
+ total_floor_area: @view_model.total_floor_area.to_i,
81
78
  status: @view_model.status,
82
79
  environmental_impact_current: @view_model.environmental_impact_current,
83
- environmental_impact_potential:
84
- @view_model.environmental_impact_potential,
80
+ environmental_impact_potential: @view_model.environmental_impact_potential,
85
81
  primary_energy_use: @view_model.respond_to?(:primary_energy_use) ? @view_model.primary_energy_use : nil,
86
82
  addendum: @view_model.addendum,
87
83
  gas_smart_meter_present: @view_model.respond_to?(:gas_smart_meter_present) ? @view_model.gas_smart_meter_present : nil,
88
84
  electricity_smart_meter_present: @view_model.respond_to?(:electricity_smart_meter_present) ? @view_model.electricity_smart_meter_present : nil,
89
85
  }
90
86
  end
91
-
92
- private
93
-
94
- def convert_to_big_decimal(node)
95
- return "" unless node
96
-
97
- BigDecimal(node, 0)
98
- end
99
87
  end
100
88
  end
101
89
  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.8
4
+ version: 2.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - MHCLG Energy Performance of Buildings