Sha256: 6a63cee0a670bfb30f53eb4174047cda748d28aadcea3c6a27d5673ea5f8aaba
Contents?: true
Size: 794 Bytes
Versions: 8
Compression:
Stored size: 794 Bytes
Contents
require 'earth/residence/residential_energy_consumption_survey_response' ResidenceAppliance.class_eval do data_miner do process "Ensure ResidentialEnergyConsumptionSurveyResponse is populated" do ResidentialEnergyConsumptionSurveyResponse.run_data_miner! end process "Derive from ResidentialEnergyConsumptionSurveyResponse" do ResidentialEnergyConsumptionSurveyResponse.column_names.grep(/_count$/).each do |column_name| appliance_name = column_name.sub '_count', '' appliance = find_or_create_by_name appliance_name appliance.annual_energy_from_electricity = ResidentialEnergyConsumptionSurveyResponse.weighted_average "annual_energy_from_electricity_for_#{appliance_name.pluralize}" appliance.save! end end end end
Version data entries
8 entries across 8 versions & 1 rubygems