def is_airplane_name_available(plane_name): all_airplanes = DataAPI.get_all_airplanes() for airplane in all_airplanes: if airplane.get_name() == plane_name: return False return True
def get_all_available_airplanes(schedule_tuple): # needs testing available_airplanes = set() for airplane in DataAPI.get_all_airplanes(): airplanes_voyages = DataAPI.get_airplane_voyages(airplane) # if there are no voyages for a specific airplane then it is available if not airplanes_voyages: available_airplanes.add(airplane) else: for voyage in airplanes_voyages: voyage_schedule = voyage.get_schedule() if schedule_tuple[0] > voyage_schedule[ 1] or schedule_tuple[1] < voyage_schedule[0]: available_airplanes.add(airplane) return AirplaneLogic.__sort_list_by_name(list(available_airplanes))
def get_all_airplanes(): #needs testing return AirplaneLogic.__sort_list_by_name(DataAPI.get_all_airplanes())