class ViewModel::Cepc800::Dec

Public Instance Methods

ac_inspection_commissioned() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 210
def ac_inspection_commissioned
  xpath(%w[AC-Inspection-Commissioned])
end
ac_kw_rating() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 218
def ac_kw_rating
  xpath(%w[AC-kW-Rating])
end
ac_present() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 214
def ac_present
  xpath(%w[AC-Present])
end
annual_energy_summary() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 178
def annual_energy_summary
  summary = @xml_doc.search("DEC-Annual-Energy-Summary")
  {
    electrical: xpath(%w[Annual-Energy-Use-Electrical], summary),
    fuel_thermal: xpath(%w[Annual-Energy-Use-Fuel-Thermal], summary),
    renewables_fuel_thermal: xpath(%w[Renewables-Fuel-Thermal], summary),
    renewables_electrical: xpath(%w[Renewables-Electrical], summary),
    typical_thermal_use: xpath(%w[Typical-Thermal-Use], summary),
    typical_electrical_use: xpath(%w[Typical-Electrical-Use], summary),
  }
end
annual_energy_use_electrical() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 102
def annual_energy_use_electrical
  xpath(%w[DEC-Annual-Energy-Summary Annual-Energy-Use-Electrical])
end
annual_energy_use_fuel_thermal() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 98
def annual_energy_use_fuel_thermal
  xpath(%w[Annual-Energy-Use-Fuel-Thermal])
end
asset_rating() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 94
def asset_rating
  xpath(%w[OR-Previous-Data Asset-Rating])
end
benchmarks() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 150
def benchmarks
  @xml_doc
    .search("Benchmarks/Benchmark")
    .map do |node|
      {
        name: xpath(%w[Name], node),
        id: xpath(%w[Benchmark-ID], node),
        tufa: xpath(%w[TUFA], node),
      }
    end
end
building_category() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 226
def building_category
  xpath(%w[Building-Category])
end
building_environment() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 86
def building_environment
  xpath(%w[Technical-Information Building-Environment])
end
calculation_tool() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 130
def calculation_tool
  xpath(%w[Calculation-Details Calculation-Tool])
end
current_assessment_date() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 26
def current_assessment_date
  xpath(%w[This-Assessment Nominated-Date])
end
current_electricity_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 34
def current_electricity_co2
  xpath(%w[This-Assessment Electricity-CO2])
end
current_heating_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 30
def current_heating_co2
  xpath(%w[This-Assessment Heating-CO2])
end
current_renewables_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 38
def current_renewables_co2
  xpath(%w[This-Assessment Renewables-CO2])
end
date_of_expiry() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 6
def date_of_expiry
  floor_area =
    xpath(%w[Display-Certificate Technical-Information Floor-Area])

  expiry_date = Date.parse(current_assessment_date)

  expiry_date =
    if floor_area.to_i <= 1000 && !postcode.start_with?("BT")
      (expiry_date - 1).next_year 10
    else
      (expiry_date - 1).next_year 1
    end

  expiry_date.strftime("%F")
end
dec_status() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 122
def dec_status
  xpath(%w[DEC-Status])
end
energy_efficiency_rating() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 22
def energy_efficiency_rating
  xpath(%w[This-Assessment Energy-Rating])
end
estimated_ac_kw_rating() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 222
def estimated_ac_kw_rating
  xpath(%w[AC-Estimated-Output])
end
floor_area() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 90
def floor_area
  xpath(%w[Technical-Information Floor-Area])
end
main_benchmark() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 194
def main_benchmark
  xpath(%w[OR-Benchmark-Data Main-Benchmark])
end
main_heating_fuel() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 82
def main_heating_fuel
  xpath(%w[Technical-Information Main-Heating-Fuel])
end
occupancy_level() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 206
def occupancy_level
  xpath(%w[Benchmarks Benchmark Occupancy-Level])
end
occupier() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 146
def occupier
  xpath(%w[Occupier])
end
or_assessment_start_date() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 142
def or_assessment_start_date
  xpath(%w[OR-Operational-Rating OR-Assessment-Start-Date])
end
or_energy_consumption() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 162
def or_energy_consumption
  @xml_doc
    .search("OR-Energy-Consumption")
    .children
    .select(&:element?)
    .map do |node|
      {
        consumption: xpath(%w[Consumption], node),
        start_date: xpath(%w[Start-Date], node),
        end_date: xpath(%w[End-Date], node),
        estimate: xpath(%w[Estimate], node),
        name: node.name,
      }
    end
end
other_fuel() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 198
def other_fuel
  xpath(%w[Technical-Information Other-Fuel-Description])
end
output_engine() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 138
def output_engine
  xpath(%w[Output-Engine])
end
property_type() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 190
def property_type
  xpath(%w[Property-Type])
end
renewables_electrical() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 118
def renewables_electrical
  xpath(%w[DEC-Annual-Energy-Summary Renewables-Electrical])
end
renewables_fuel_thermal() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 114
def renewables_fuel_thermal
  xpath(%w[DEC-Annual-Energy-Summary Renewables-Fuel-Thermal])
end
special_energy_uses() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 202
def special_energy_uses
  xpath(%w[Technical-Information Special-Energy-Uses])
end
typical_electrical_use() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 110
def typical_electrical_use
  xpath(%w[DEC-Annual-Energy-Summary Typical-Electrical-Use])
end
typical_thermal_use() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 106
def typical_thermal_use
  xpath(%w[DEC-Annual-Energy-Summary Typical-Thermal-Use])
end
year1_assessment_date() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 42
def year1_assessment_date
  xpath(%w[Year1-Assessment Nominated-Date])
end
year1_electricity_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 50
def year1_electricity_co2
  xpath(%w[Year1-Assessment Electricity-CO2])
end
year1_energy_efficiency_rating() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 58
def year1_energy_efficiency_rating
  xpath(%w[Year1-Assessment Energy-Rating])
end
year1_heating_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 46
def year1_heating_co2
  xpath(%w[Year1-Assessment Heating-CO2])
end
year1_renewables_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 54
def year1_renewables_co2
  xpath(%w[Year1-Assessment Renewables-CO2])
end
year2_assessment_date() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 62
def year2_assessment_date
  xpath(%w[Year2-Assessment Nominated-Date])
end
year2_electricity_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 70
def year2_electricity_co2
  xpath(%w[Year2-Assessment Electricity-CO2])
end
year2_energy_efficiency_rating() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 78
def year2_energy_efficiency_rating
  xpath(%w[Year2-Assessment Energy-Rating])
end
year2_heating_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 66
def year2_heating_co2
  xpath(%w[Year2-Assessment Heating-CO2])
end
year2_renewables_co2() click to toggle source
# File lib/view_model/cepc800/dec.rb, line 74
def year2_renewables_co2
  xpath(%w[Year2-Assessment Renewables-CO2])
end