def is_flight_attendant_ssn_avaliable(flight_attendant_ssn): all_flight_attendants = DataAPI.get_all_flight_attendants() for flight_attendant in all_flight_attendants: if flight_attendant.get_ssn() == flight_attendant_ssn: return return True
def get_flight_attendant(ssn): '''Returns a flight_attendant with the given ssn, if no flight_attendant has the given ssn None is returned''' all_flight_attendants = DataAPI.get_all_flight_attendants() for flight_attendant in all_flight_attendants: if flight_attendant.get_ssn() == ssn: return flight_attendant return None
def get_available_flight_attendants(schedule_tuple): all_flight_attendants = DataAPI.get_all_flight_attendants() available_flight_attendants = set() for flight_attendant in all_flight_attendants: voyages = FlightAttendantLogic.get_all_flight_attendant_voyages(flight_attendant) if not voyages: available_flight_attendants.add(flight_attendant) else: for voyage in voyages: voyage_schedule = voyage.get_schedule() if schedule_tuple[0] > voyage_schedule[1] or schedule_tuple[1] < voyage_schedule[0]: available_flight_attendants.add(flight_attendant) return FlightAttendantLogic.__sort_list_by_name(list(available_flight_attendants))
def get_all_flight_attendants(): return FlightAttendantLogic.__sort_list_by_name(DataAPI.get_all_flight_attendants())