lib/models/trip_leg.rb in fossil-0.4.7 vs lib/models/trip_leg.rb in fossil-0.4.8

- old
+ new

@@ -719,10 +719,23 @@ minutes_between = (planned_arrival_date_time_gmt - planned_departure_date_time_gmt) * 1440; Time.from_minutes(minutes_between) end def is_deadhead? - (status==1 or verify_date > 0) and (deadhead==1 or pax_count==0) and [107, 115, 108, 104].include? leg_type_code + deadhead==1 or pax_count==0 +# (status==1 or verify_date > 0) and (deadhead==1 or pax_count==0) and [107, 115, 108, 104].include? leg_type_code + end + + def is_completed_leg? + is_flown? and (land_time_act_gmt!=1440 and land_time_act_gmt!=0) + end + + def departed? + (dept_time_act_gmt!=0 and dept_time_act_gmt!=1440) + end + + def delayed? + Time.now.utc > planned_departure_date_time_gmt and !departed? end # sort on lead_pax value to lead pax = 1 is first and the lead_pax values of 0 are all after def passenger_list return '' if trip__passengers.blank? or is_deadhead? \ No newline at end of file