lib/earth/air/flight_segment/data_miner.rb in earth-0.3.15 vs lib/earth/air/flight_segment/data_miner.rb in earth-0.4.0
- old
+ new
@@ -182,10 +182,11 @@
string 'destination_airport_iata_code'
string 'destination_country_iso_3166_code'
integer 'year'
integer 'quarter'
integer 'month'
+ date 'approximate_date'
# integer 'bts_aircraft_group_code'
# string 'configuration_id'
# integer 'bts_aircraft_configuration_code'
# string 'distance_group'
# integer 'bts_distance_group_code'
@@ -311,9 +312,13 @@
update_all 'load_factor = 1', 'passengers > total_seats AND total_seats > 0'
end
process "Derive average seats per departure" do
update_all 'seats = total_seats / departures_performed', 'departures_performed > 0'
+ end
+
+ process "Add a useful date field" do
+ update_all 'approximate_date = DATE(CONCAT_WS("-", year, month, "14"))'
end
# FIXME TODO make this verification check actual aircraft codes in Aircraft
verify 'All segments have an associated aircraft' do
FlightSegment.where(:aircraft_bts_code => [nil, '']).first.nil?