Sha256: bcc17ce7ea0693016404d55de2906f794709ac19ce6457905789447da015e940
Contents?: true
Size: 862 Bytes
Versions: 8
Compression:
Stored size: 862 Bytes
Contents
AutomobileActivityYear.class_eval do data_miner do process "Ensure AutomobileActivityYearType is populated" do AutomobileActivityYearType.run_data_miner! end process "Derive from AutomobileActivityYearType" do ::Earth::Utils.insert_ignore( :src => AutomobileActivityYearType, :dest => AutomobileActivityYear, :cols => { :activity_year => :activity_year } ) end process "Derive hfc emission factor from AutomobileActivityYearType" do safe_find_each do |ay| ay.update_attributes!( :hfc_emission_factor => ay.activity_year_types.sum(&:hfc_emissions) / ay.activity_year_types.sum{ |ayt| ayt.activity_year_type_fuels.sum(&:distance) }, :hfc_emission_factor_units => ay.activity_year_types.first.hfc_emission_factor_units ) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems