lib/earth/air/flight_segment/data_miner.rb in earth-0.3.1 vs lib/earth/air/flight_segment/data_miner.rb in earth-0.3.2

- old
+ new

@@ -162,11 +162,11 @@ schema Earth.database_options do string 'row_hash' integer 'departures_performed' integer 'passengers' integer 'total_seats' - float 'payload' # this needs to be a float because the import includes a units conversion + float 'payload' # theoretical max freight + mail + passengers; needs to be a float because the import includes a units conversion string 'payload_units' float 'freight' # this needs to be a float because the import includes a units conversion string 'freight_units' float 'mail' # this needs to be a float because the import includes a units conversion string 'mail_units' @@ -297,11 +297,11 @@ # store 'dest_country_name', :field_name => 'DEST_COUNTRY_NAME' # store 'dest_wac', :field_name => 'DEST_WAC' end end - process "Derive freight share as a fraction of payload" do - update_all 'freight_share = (freight + mail) / payload', 'payload > 0' + process "Derive freight share as a fraction of the total weight carried" do + update_all 'freight_share = (freight + mail) / (freight + mail + (passengers * 90.718474))', '(freight + mail + passengers) > 0' end process "Derive load factor, which is passengers divided by the total seats available" do update_all 'load_factor = passengers / total_seats', 'total_seats > 0' end