Esempio n. 1
0
 def listPilots(self):
     ''' prints all pilots '''
     pilot_list = LL_API().get_Pilots()
     print("{:^44}".format('All pilots'))
     print("."*44)
     print()
     for name, rank in pilot_list.items():
         print(name, '-', rank)
Esempio n. 2
0
 def listCabinCrew(self):
     ''' prints all cabin crew '''
     cabin_list = LL_API().get_Cabin()
     print("{:^44}".format('All cabin crew members'))
     print("."*44)
     print()
     for name, rank in cabin_list.items():
         print(name, '-', rank)
Esempio n. 3
0
 def list_pilots_for_planetypeID(self):
     '''Prints all pilots with license on each plane type'''
     pilotlisence_dict = LL_API().listPilots_planetype()
     for plane, pilots in pilotlisence_dict.items():
         print('\n\n{:^44}'.format(plane))
         print('.'*44)
         print()
         for name, rank in pilots.items():
             print('{} - {}'.format(name, rank))
Esempio n. 4
0
    def listAllEmployeesWorkingOnSpecificDay(self):
        ''' prints a list of people working on specific day '''
        year_input = input("Year: ")
        year = LL_API().checkIfValidDate(year_input)
        if year == None:
            print("Not a valid year")
        else:
            month_input = input("Month: ")
            month = LL_API().checkIfValidDate(month_input)
            if month == None:
                print("Not a valid month")
            else:
                day_input = input("Day: ")
                day = LL_API().checkIfValidDate(day_input)
                if day == None:
                    print("Not a valid day")
                else:
                    print()
                    start_time = datetime.datetime(year, month, day, 0, 0, 0).isoformat()
                    employee_dict = LL_API().EmployeesWorking(start_time)

                    print('\n{:^44}'.format('Pilots'))
                    print('.'*44)
                    for crewMember, voyage in employee_dict.items():
                        if crewMember.role == 'Pilot':
                            print('\n{} - {}\n'.format(crewMember.name, crewMember.rank))
                            print('\t {} - {}'.format(voyage.flightOut.departingFrom, voyage.flightOut.arrivingAt))
                            print('\t {} - {}'.format(voyage.flightBack.departingFrom, voyage.flightBack.arrivingAt))
                            print()
                    
                    print('\n{:^44}'.format('Cabin crew'))
                    print('.'*44)
                    for crewMember, voyage in employee_dict.items():
                        if crewMember.role == 'Cabincrew':
                            print('\n{} - {}\n'.format(crewMember.name, crewMember.rank))
                            print('\t {} - {}'.format(voyage.flightOut.departingFrom, voyage.flightOut.arrivingAt))
                            print('\t {} - {}'.format(voyage.flightBack.departingFrom, voyage.flightBack.arrivingAt))
                            print()
Esempio n. 5
0
    def listAircraftTypes(self):
        ''' prints all aircraft types '''
        aircraftType_list = LL_API().get_aircraftType_list()
        aircraft_list = LL_API().get_aircrafts_list()
        voyage = self.AircraftStatus(aircraft_list)
        pilot_count = LL_API().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:
                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()