def get_voyages_by_destination(destination): #needs testing all_voyages = DataAPI.get_all_voyages() desired_voyages = [] for voyage in all_voyages: if destination in voyage.get_flights()[0].get_arrival_location(): desired_voyages.append(voyage) return desired_voyages
def get_airplane_voyages(airplane): #needs testing all_voyages = DataAPI.get_all_voyages() airplane_voyages = [] for voyage in all_voyages: if voyage.get_airplane() == airplane: airplane_voyages.append(voyage) return airplane_voyages
def get_voyages_by_date(date): #needs testing all_voyages = DataAPI.get_all_voyages() desired_voyages = [] for voyage in all_voyages: if voyage.get_schedule()[0].date() == date: desired_voyages.append(voyage) return desired_voyages
def get_all_flight_attendant_voyages(flight_attendant): all_voyages = DataAPI.get_all_voyages() flight_attendant_voyages_list = [] for voyage in all_voyages: if flight_attendant in voyage.get_flight_attendants(): flight_attendant_voyages_list.append(voyage) return flight_attendant_voyages_list
def get_all_pilot_voyages(pilot): all_voyages = DataAPI.get_all_voyages() pilot_voyages_list = [] for voyage in all_voyages: if pilot in voyage.get_pilots(): pilot_voyages_list.append(voyage) return pilot_voyages_list
def get_completed_voyages(): #needs testing all_voyages = DataAPI.get_all_voyages() completed_voyages = [] completed_state = State.get_voyage_states()[4] for voyage in all_voyages: if voyage.get_state() == completed_state: completed_voyages.append(voyage) return completed_voyages
def get_ongoing_voyages(): #needs testing all_voyages = DataAPI.get_all_voyages() ongoing_voyages = [] completed_state = State.get_voyage_states()[4] for voyage in all_voyages: if voyage.get_state() != completed_state: ongoing_voyages.append(voyage) return ongoing_voyages
def get_voyages_by_week(week): #needs testing all_voyages = DataAPI.get_all_voyages() desired_voyages = [] for voyage in all_voyages: #Get which week in the year each voyage is scheduled voyage_week_in_year_int = voyage.get_schedule()[0].date( ).isocalendar()[1] if voyage_week_in_year_int == week: desired_voyages.append(voyage) return desired_voyages
def is_voyage_schedule_start_day_and_time_available(voyage_day_and_time): all_voyages = DataAPI.get_all_voyages() for voyage in all_voyages: if voyage.get_schedule()[0] == voyage_day_and_time: return False return True
def get_all_voyages(): return DataAPI.get_all_voyages()