lib/models/trip_leg.rb in fossil-0.3.30 vs lib/models/trip_leg.rb in fossil-0.3.31
- old
+ new
@@ -625,16 +625,10 @@
#### END GENERATED SECTION ####
# delegators
delegate :lead_pax, :to => :trip
delegate :passenger_list, :to => :trip
- delegate :name, :to => :arrival_airport, :prefix=>true, :allow_nil=>true
- delegate :name, :to => :departure_airport, :prefix=>true, :allow_nil=>true
- delegate :city, :to => :arrival_airport, :prefix=>true, :allow_nil=>true
- delegate :city, :to => :departure_airport, :prefix=>true, :allow_nil=>true
- delegate :state_abbreviation, :to => :arrival_airport, :prefix=>true, :allow_nil=>true
- delegate :state_abbreviation, :to => :departure_airport, :prefix=>true, :allow_nil=>true
# Column views
column_view :dept_date_act_gmt, :date, :actual_departure_date_gmt
column_view :dept_time_act_gmt, :time, :actual_departure_time_gmt
column_def_datetime :actual_departure_date_time_gmt, :'dept date act gmt', :'dept time act gmt'
@@ -713,31 +707,33 @@
end
def pic_crew; pilot_crew(:pic); end
def sic_crew; pilot_crew(:sic); end
def ebt_time
- minutes_between = (planned_arrival_date_time_gmt - planned_departure_date_time_gmt)/60;
+ # subtracting the two datetimes yields a fraction of a day, so multiplying by minutes
+ # in day ( 1440 ) to get total minutes difference. assumes flights not more than 24 hours.
+ minutes_between = (planned_arrival_date_time_gmt - planned_departure_date_time_gmt) * 1440;
Time.from_minutes(minutes_between)
end
#### aliases and special methods #####
# This method guarantees an icao for a view that needs one. If there is an icao, use it, otherwise make
# it from the prefix and airport_id .. which works as an icao, but beware, because these put together
# icao's that you make are valid icao codes, but you can't search the airport based it, since these
# airport rows don't have an icao code at all, they only have the prefix and airport_id. whacky.
def departure_icao_val
- departure_icao || depart_ap_prefix + depart_airport_id
+ departure_icao.blank? ? depart_ap_prefix + depart_airport_id : ''
end
# same comment as above
def arrival_icao_val
- arrival_icao || arrival_ap_prefix + arrival_airport_id
+ arrival_icao.blank? ? arrival_ap_prefix + arrival_airport_id : ''
end
def departure_icao_expanded
- "#{departure_icao_val} #{departure_airport_name} #{departure_airport_city} ,#{departure_airport_state_abbreviation}"
+ "#{departure_icao_val} #{departure_airport__name} #{departure_airport__city} ,#{departure_airport__state_abbreviation}"
end
-
+
def arrival_icao_expanded
- "#{arrival_icao_val} #{arrival_airport_name} #{arrival_airport_city} ,#{arrival_airport_state_abbreviation}"
+ "#{arrival_icao_val} #{arrival_airport__name} #{arrival_airport__city} ,#{arrival_airport__state_abbreviation}"
end
end
\ No newline at end of file