def findArrivalTime(self, dest_code, depart_time_datetime): '''Takes in destination code and departure time and returns arrival time at destination as datetime object.''' destinations_instances = DestinationLL().getDestination() duration_str = '' # finds duration of flight to destination as string for destination in destinations_instances: if dest_code == destination.getDestinationAirport(): duration_str = destination.getDestinationDuration() # turns duration string into int values, form of string is xxhxxm where x are numbers index_of_h_int = duration_str.find('h') if index_of_h_int == 1: hrs_int = int(duration_str[0]) else: hrs_int = int(duration_str[:(index_of_h_int - 1)]) mins_int = int(duration_str[(index_of_h_int + 1):3]) arrival_time_datetime = depart_time_datetime + datetime.timedelta( hours=hrs_int, minutes=mins_int) return arrival_time_datetime
def checkDestInput(self, dest_input): '''Checks if destination IATA code is valid. Returns true if it is valid, else false''' # all destinations destinations_instances = DestinationLL().getDestination() boolOutcome = False # if input is of correct length if len(dest_input) == 3: for destination in destinations_instances: # if input matches any of the dest codes if dest_input == destination.getDestinationAirport(): boolOutcome = True return boolOutcome
def addDestination(self, new_destination): '''Creates a new destination in file''' return DestinationLL().addDestination(new_destination)
def changeEmergencyContact(self, destination_instance): '''Takes in an updated instance and writes it into the destinations file''' return DestinationLL().changeDestinationFile(destination_instance)
def get_destinations(self): '''Gets all destinations NaN Air flies to and returns a list of class instances''' return DestinationLL().getDestination()
class MainLL: '''Instances of all sub LL classes created so that MainLL has access to all functions within them. The MainLL class functionality is only to be the link between the UI layer and appropriate LL classes. Therefore the MainLL class is only function calls''' def __init__(self): self.staffObject = StaffLL() self.airplaneObject = AirplaneLL() self.destinationObject = DestinationLL() self.voyageObject = VoyageLL() def getAllStaffLL(self): return self.staffObject.getAllStaff() def getStaffByIDLL(self, ssn): return self.staffObject.getStaffByID(ssn) def getAirplanesLL(self): return self.airplaneObject.getAirplanes() def getAirplaneByIdLL(self, ID): return self.airplaneObject.getAirplaneByID(ID) def getVoyageLL(self): return self.voyageObject.listVoyage() def getAllPilotsLL(self): return self.staffObject.getAllPilots() def getLicenseDictLL(self): return self.airplaneObject.getLicenseDict() def getAllCabinCrewLL(self): return self.staffObject.getAllCabinCrew() def addAirplaneLL(self, newAirplane): return self.airplaneObject.addAirplane(newAirplane) def getAirplaneStatusLL(self, date, time): return self.airplaneObject.getAirplaneStatus(date, time) def getStaffDataLL(self, dataList): return self.staffObject.getStaffData(dataList) def addNewStaffLL(self, newEmployee): return self.staffObject.addNewStaff(newEmployee) def getAllDestinationsLL(self): return self.destinationObject.getDestination() def addNewDestinationLL(self, newDestination): return self.destinationObject.addNewDestination(newDestination) def addNewVoyageLL(self, newFlight): return self.voyageObject.addVoyages(newFlight) def updateVoyageLL(self, dataList, staffList): return self.voyageObject.updateVoyage(dataList, staffList) def updateDestinationLL(self, dataList): return self.destinationObject.updateDestination(dataList) def addLicenseLL(self, dataList): return self.airplaneObject.addLicense(dataList) def workScheduleLL(self, workDay): return self.staffObject.getWorkSchedule(workDay) def workScheduleAvailableLL(self, workDay): return self.staffObject.getWorkSchedlueAvailable(workDay) def generateFlightNumberLL(self, flight): return self.voyageObject.generateFlightNumber(flight) def availableDatesLL(self): return self.voyageObject.availableDates() def workWeekLL(self, dataList): return self.voyageObject.getWorkWeek(dataList) def getAvailableFlightAttendantsLL(self, flight): return self.voyageObject.findAvailableFlightAttendants(flight) def getAvailableFlightServiceManagersLL(self, flight): return self.voyageObject.findAvailableFlightServiceManagers(flight) def getAvailableCoPilotsLL(self, flight): return self.voyageObject.findAvailableCoPilots(flight) def getAvailableCaptainsLL(self, flight): return self.voyageObject.findAvailableCaptains(flight) def errorCheckDateLL(self, flight): return self.voyageObject.errorCheckDate(flight) def flightCollisionLL(self, flight): return self.voyageObject.flightCollision(flight) def findArrivalTimeLL(self, flight): return self.voyageObject.findArrivalTime(flight) def findAvalibleAirplanesLL(self, flight): return self.voyageObject.findAvalibleAirplanes(flight) def generateSecondFlightLL(self, flight): return self.voyageObject.generateSecondFlight(flight) def generadeDestinationIdLL(self): return self.destinationObject.generadeDestinationId()
def __init__(self): self.staffObject = StaffLL() self.airplaneObject = AirplaneLL() self.destinationObject = DestinationLL() self.voyageObject = VoyageLL()
def __init__(self): self.__ioAPI = IOAPI() self.destLL = DestinationLL(self.__ioAPI) self.voyLL = VoyageLL(self.__ioAPI) self.plaLL = PlaneLL(self.__ioAPI) self.empLL = EmployeeLL(self.__ioAPI)
class LLAPI(): def __init__(self): self.__ioAPI = IOAPI() self.destLL = DestinationLL(self.__ioAPI) self.voyLL = VoyageLL(self.__ioAPI) self.plaLL = PlaneLL(self.__ioAPI) self.empLL = EmployeeLL(self.__ioAPI) def getDestinationHeader(self, list_of_destination): return self.destLL.getDestinationHeader(list_of_destination) def getDestinationValue(self, list_of_destination): return self.destLL.getDestinationValue(list_of_destination) def getDestinations(self): return self.destLL.getDestination() def createDestination(self, dest): return self.destLL.storeDestinationToFile(dest) def getDestinationsContactInfo(self): return self.destLL.getDestinationsContactInfo() def updateContactInfo(self, line_index, row_index, updated_info): return self.destLL.updateContactInfo(line_index, row_index, updated_info) def createVoyage(self, voyage): return self.voyLL.createVoyage(voyage) def getVoyages(self): return self.voyLL.getVoyages() def getFullyStaffedVoyages(self): return self.voyLL.getFullyStaffedVoyages() def getVoyagesWeek(self, first_day_of_week): return self.voyLL.getVoyagesWeek(first_day_of_week) def getVoyagesDay(self, date): return self.voyLL.getVoyagesDay(date) def getVoyageHeader(self, voyage_list): return self.voyLL.getVoyageHeader(voyage_list) def getVoyageValue(self, voyage_list): return self.voyLL.getVoyageValue(voyage_list) def createPlane(self, plane): return self.plaLL.createPlane(plane) def getPlanes(self): return self.plaLL.getPlanes() def getPlaneType(self, registration): return self.plaLL.getPlaneType(registration) def getPlaneType_list(self): return self.plaLL.getPlaneType_list() def getAvailablePlanes(self, date, totalTime): return self.plaLL.getAvailablePlanes(date, totalTime) def createEmployee(self, employee): return self.empLL.createEmployee(employee) def getEmployees(self): return self.empLL.getEmployees() def updateEmployee(self, line_index, row_index, updated_info): return self.empLL.updateEmployee(line_index, row_index, updated_info) def getEmployeeHeader(self, employee_list): return self.empLL.getEmployeeHeader(employee_list) def getEmployeeValue(self, employee_list): return self.empLL.getEmployeeValue(employee_list) def getPilotsOrFAs(self, empType): return self.empLL.getPilotsOrFAs(empType) def getSpecificEmployee(self, emp_id=''): return self.empLL.getSpecificEmployee(emp_id) def getAvailabilityOfPilots(self, date, listType): return self.empLL.getAvailabiltyOfPilots(date, listType) def getAvailabiltyOfFAs(self, date, listType): return self.empLL.getAvailabiltyOfFAs(date, listType) def getAvailabilityOfAll(self, date, listType): return self.empLL.getAvailabilityOfAll(date, listType) def getChosenEmployee(self, id_list, emp_id): return self.empLL.getChosenEmployee(id_list, emp_id) def getUnmannedVoyages(self): return self.voyLL.getUnmannedVoyages() def availablePilotsWithSpecificLicense(self, time, aircraftType): return self.empLL.availablePilotsWithSpecificLicense( time, aircraftType) def storeCrewToFile(self, voyage): self.voyLL.storeCrewToFile(voyage) def getPlaneStatus(self, dateTime): return self.plaLL.getPlaneStatus(dateTime) def createDestinationObject(self, destination_str): return self.destLL.createDestinationObject(destination_str) def checkDateTime(self, dateTime): return self.voyLL.checkDateTime(dateTime)