Example #1
0
    def setAircraft(self, planeTypeId):
        ''' set new aircraft '''
        planeInsignia = input('Plane Insignia: ')
        planeTypeId = planeTypeId

        aircraft = Model_Aircrafts(planeInsignia, planeTypeId)
        LL_Aircrafts().set_aircraft(aircraft)
Example #2
0
 def listPilots_planetype(self):
     ''' Returns a dict of pilots with license on each plane type '''
     planetypeID_list = LL_Aircrafts().planetypeID_list()
     planetypeID_set = set(planetypeID_list)
     planetype_pilot = {}
     for elem in planetypeID_set:
         get_License = self.get_License(elem)
         planetype_pilot[elem] = get_License
     return planetype_pilot
Example #3
0
    def listAircraftTypes(self):
        ''' prints all aircraft types '''
        aircraftType_list = LL_Aircrafts().get_aircraftType_list(
        )  # listi af aircraft Types
        aircraft_list = LL_Aircrafts().get_aircrafts_list(
        )  # listi af aircrafts
        voyage = self.AircraftStatus(aircraft_list)
        pilot_count = LL_Employee().get_pilot_count()

        print()
        for aircraftType in aircraftType_list:
            print("{:^44}".format(aircraftType.planeTypeId))
            print("." * 44)
            print(
                "\nName: {} \nManufacturer: {} \nModel: {} \nCapacity: {} \nEmpty weight: {} \nMax takeoff weight: {} \nUnit thrust: {} \nService ceiling: {} \nLength: {} \nHeight: {} \nWingspan: {}"
                .format(aircraftType.name, aircraftType.manufacturer,
                        aircraftType.model, aircraftType.capacity,
                        aircraftType.emptyWeight,
                        aircraftType.maxTakeoffWeight, aircraftType.unitThrust,
                        aircraftType.serviceCeiling, aircraftType.length,
                        aircraftType.height, aircraftType.wingspan))
            if aircraftType.planeTypeId in pilot_count.keys():
                for planeID, count in pilot_count.items():
                    if planeID == aircraftType.planeTypeId:
                        print('Pilots with license: {}'.format(count))
            else:
                print('Pilots with license: {}'.format('0'))

            for line in aircraft_list:
                #line.planeTypeId.strip()
                if line.planeTypeId.strip() == aircraftType.planeTypeId:
                    for elem in voyage:
                        if elem.flightOut.aircraftID == line.planeInsignia:
                            print()
                            print("{:^44}".format("Aircraft is active"))
                            print()
                            print("Flight number:",
                                  elem.flightOut.flightNumber)
                            print("Destination:", elem.flightOut.arrivingAt)
                            print('Next available time:',
                                  elem.flightBack.arrival)

            print()
Example #4
0
 def PilotWithLisence(self, pilot_list, aircraftID):
     ''' Returns a list of pilots with a specific license '''
     cap_with_lisence = []
     aircraftlist = LL_Aircrafts().get_aircrafts_list()
     lisence = ""
     for elem in aircraftlist:
         if elem.planeInsignia == aircraftID:
             lisence = elem.planeTypeId.strip()
     for elem in pilot_list:
         if elem.license == lisence:
             cap_with_lisence.append(elem)
     return cap_with_lisence
Example #5
0
    def SetPilot(self):
        ''' set new pilot '''
        ssn = input('Social security number: ')
        valid_ssn = LL_Employee().checkIfValidssn(ssn)
        if valid_ssn == None:
            print(":: Not a valid social security number ::")
        else:
            ssn = valid_ssn
            name = input('Full name: ').title()
            firstname = name.split()
            role = 'Pilot'    
            print("1: Captain")
            print("2: Copilot")
            rank_input = input('Rank: ')   
            if rank_input == 1:
                rank = "Captain"
            elif rank_input == 2:
                rank = "Copilot"



            planetypeID_list = LL_Aircrafts().planetypeID_list()
            for num, elem in enumerate(planetypeID_list):
                print(num+1, ': ', elem)
            pilotlicense_inp = input('Pilot license: ')
            if pilotlicense_inp == elem:
                pilot_license = pilotlicense_inp[pilotlicense_inp-1]





            address = input('Address: ')
            try:
                phone = int(input('Phone: '))
            except ValueError:
                print("\n:: Invalid phone ::\n")
                phone = input('Phone: ')
            email = firstname[0] + "@nan.is"

            employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
            LL_Employee().createEmployee(employee)

            print("\n:: {} has been added as a Pilot ::".format(name))
Example #6
0
    def setAircraftTypes(self):
        ''' set new aircraft type '''
        manufacturer = input('Manufacturer: ')
        model = input('Model: ')
        planeTypeId = "NA" + manufacturer + model
        capacity = input('Capacity: ')
        emptyWeight = input('Empty Weight: ')
        maxTakeoffWeight = input('Max Takeoff Weight: ')
        unitThrust = input('Unit Thrust: ')
        serviceCeiling = input('Service Ceiling: ')
        length = input('Length: ')
        height = input('Height: ')
        wingspan = input('Wingspan: ')
        name = input('Name: ')

        aircraftType = Model_AircraftType(planeTypeId, manufacturer, model,
                                          capacity, emptyWeight,
                                          maxTakeoffWeight, unitThrust,
                                          serviceCeiling, length, height,
                                          wingspan, name)
        LL_Aircrafts().set_aircraftType(aircraftType)
        self.setAircraft(planeTypeId)

        print('\n:: {} has been added as a aircraft ::'.format(planeTypeId))
Example #7
0
 def get_aircraftType_list(self):
     return LL_Aircrafts().get_aircraftType_list()
Example #8
0
 def planetypeID_list(self):
     return LL_Aircrafts().planetypeID_list()
Example #9
0
 def getAircraftStatus(self, aircraft_list):
     return LL_Aircrafts().getAircraftStatus(aircraft_list)
Example #10
0
 def availableAircrafts(self, start_time):
     return LL_Aircrafts().availableAircrafts(start_time)
Example #11
0
 def set_aircraft(self, aircraftToCreate):
     return LL_Aircrafts().set_aircraft(aircraftToCreate)
Example #12
0
 def set_aircraftType(self, aircraftTypeToCreate):
     return LL_Aircrafts().set_aircraftType(aircraftTypeToCreate)
Example #13
0
 def listAircrafts(self):
     ''' prints all aircrafts '''
     result = LL_Aircrafts().get_aircrafts_list()
     for aircrafts in result:
         print(aircrafts)
Example #14
0
 def AircraftStatus(self, aircraft_list):
     '''Returns a list of status for voyage'''
     voyage = LL_Aircrafts().getAircraftStatus(aircraft_list)
     return voyage
Example #15
0
    def create_voyage(self):
        '''Gets all necessary input to create a new Voyage'''
        flightNumber = input('Enter flight number fx "NA0000" : ')
        update = LL_Voyages().checkIfValidFlightNumber(flightNumber)

        if update == False:
            print("\n:: Invalid flight number ::")
        else:
            dest_list = LL_Voyages().get_dest_id_list()
            print("\n{:^44}".format("List of Destiantions"))
            print("."*44)
            for num, elem in enumerate(dest_list):
                print('{}: {}'.format(num+1, elem))

            print("_"*44)
            voyage_destiantion = int(input('Choose Destination: '))
            arrivingAt = dest_list[voyage_destiantion-1]

            try:
                year = int(input("Enter Year of departure: "))

            except ValueError:
                print("\n:: Not a valid year ::\n")
                year = int(input("Enter Year of departure: "))

            try:
                month = int(input("Enter Month of departure: "))
            except ValueError:
                print("\n:: Not a valid month ::\n")
                month = int(input("Enter Month of departure: "))

            try:
                day = int(input("Enter Day of departure: "))
            except ValueError:
                print("\n:: Not a valid day ::\n")
                day = int(input("Enter Day of departure: "))

            try:
                hour = int(input("Enter Hour of departure: "))
            except ValueError:
                print("\n:: Not a valid hour ::\n")
                hour = int(input("Enter Hour of departure: "))

            try:
                minute = int(input("Enter Minute of departure: "))
            except ValueError:
                print("\n:: Not a valid minute ::")
                minute = int(input("Enter Minute of departure: "))


            date_time = datetime.datetime(year, month, day, hour, minute, 0).isoformat()
            valid_FlightTime = LL_Voyages().checkIfValidFlightTime(date_time)
            if valid_FlightTime == False:
                print("\n:: Invalid flight time ::")

            else:
                aricraft_plainInsignia = LL_Aircrafts().availableAircrafts(date_time)
                print("\n{:^44}".format("List of available Aircrafts"))
                print("."*44)

                for num, elem in enumerate(aricraft_plainInsignia):
                    print('{}: {}'.format(num+1, elem.planeInsignia))

                print("_"*44)
                voyage_aircraft = int(input('Choose Aircraft: '))
                aircraftID = aricraft_plainInsignia[voyage_aircraft-1]

                date_time_ofDeparture = datetime.datetime(year, month, day, hour, minute, 0)
                LL_Voyages().create_flight(flightNumber, arrivingAt, date_time_ofDeparture, aircraftID.planeInsignia)

                print('\n:: Voyage to {} has been added ::'.format(arrivingAt))