Esempio n. 1
0
 def getAircraftStatus(self, aircraft_list):
     '''Returns a list of status for voyage'''
     voyage_list = LL_Voyages().get_voyage_list()
     voyage = []
     for elem in aircraft_list:
         for line in voyage_list:
             if elem.planeInsignia == line.flightOut.aircraftID:
                 check_status = LL_Voyages().checkVoyageStatus(line)
                 if check_status == "Aircraft is in air" or check_status == "Aircraft has landed at destination":
                     voyage.append(line)
     return voyage
Esempio n. 2
0
    def listByWeekFilter(self):
        ''' prints all voyages in a specific week '''

        print("From")
        print("----")
        from_year_input = input("Year: ")
        from_year = LL_Employee().checkIfValidDate(from_year_input)
        if from_year == None:
            print("\n:: Not a valid year ::")
        else:
            from_month_input = input("Month: ")
            from_month = LL_Employee().checkIfValidDate(from_month_input)
            if from_month == None:
                print("\n:: Not a valid month ::")
            else:
                from_day_input = input("Day: ")
                from_day = LL_Employee().checkIfValidDate(from_day_input)
                if from_day == None:
                    print("\n:: Not a valid day ::")
                else:
                    print("\nTo")
                    print("----")
                    to_year_input = input("Year: ")
                    to_year = LL_Employee().checkIfValidDate(to_year_input)
                    if to_year == None:
                        print("\n:: Not a valid year ::")
                    else:
                        to_month_input = input("Month: ")
                        to_month = LL_Employee().checkIfValidDate(to_month_input)
                        if to_month == None:
                            print("\n:: Not a valid month ::")
                        else:
                            to_day_input = input("Day: ")
                            to_day = LL_Employee().checkIfValidDate(to_day_input)
                            if to_day == None:
                                print("\n:: Not a valid day ::")
                            else:
                                print()
                                from_date = datetime.datetime(from_year, from_month, from_day, 0, 0, 0).isoformat()
                                to_date = datetime.datetime(to_year, to_month, to_day+1, 0, 0, 0).isoformat()
                                result = LL_Voyages().Week_Time(from_date, to_date)
                                print()
                                if len(result) == 0:
                                    print(":: No Voyage on selected date ::")
                                else:
                                    for voyage in result:
                                        status_now = self.VoyageStatusNow(voyage)
                                        crew_status = self.VoyageCrewStatus(voyage)
                                        print('{:>22} {} {:<22}'.format(voyage.flightOut.flightNumber, '-', voyage.flightBack.flightNumber))
                                        print('.'*44,'\n')
                                        print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightOut.departingFrom, voyage.flightOut.arrivingAt, voyage.flightOut.departure, voyage.flightOut.arrival))
                                        print()
                                        print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightBack.departingFrom, voyage.flightBack.arrivingAt, voyage.flightBack.departure, voyage.flightBack.arrival))
                                        if crew_status == True:
                                            print('Crew: \n\tCaptain: {} \n\tCopilot: {} \n\tfsm: {} \n\tfa1: {} \n\tfa2: {}'.format(voyage.captain, voyage.copilot, voyage.fsm, voyage.fa1, voyage.fa2))
                                        else:
                                            print()
                                            print(crew_status)
                                        print('\nStatus: \n\t{}'.format(status_now))
                                        print()
Esempio n. 3
0
    def listEmployeesVoyagesInSpecificWeek(self):
        ''' prints a list of employyes voyages in specific week '''
        name = input("Full name: ").title()
        usersWithName = LL_Employee().getOneEmployeeName(name)

        if len(usersWithName) == 0:
            print(":: No user with that name ::")
        else:
            for elem in usersWithName:
                ssn = elem.ssn

        print("From")
        print("----")
        from_year_input = input("Year: ")
        from_year = LL_Employee().checkIfValidDate(from_year_input)
        if from_year == None:
            print(":: Not a valid year ::")
        else:
            from_month_input = input("Month: ")
            from_month = LL_Employee().checkIfValidDate(from_month_input)
            if from_month == None:
                print(":: Not a valid month ::")
            else:
                from_day_input = input("Day: ")
                from_day = LL_Employee().checkIfValidDate(from_day_input)
                if from_day == None:
                    print(":: Not a valid day ::")
                else:
                    print("\nTo")
                    print("----")
                    to_year_input = input("Year: ")
                    to_year = LL_Employee().checkIfValidDate(to_year_input)
                    if to_year == None:
                        print(":: Not a valid year ::")
                    else:
                        to_month_input = input("Month: ")
                        to_month = LL_Employee().checkIfValidDate(to_month_input)
                        if to_month == None:
                            print(":: Not a valid month ::")
                        else:
                            to_day_input = input("Day: ")
                            to_day = LL_Employee().checkIfValidDate(to_day_input)
                            if to_day == None:
                                print(":: Not a valid day ::")
                            else:
                                print()
                                from_date = datetime.datetime(from_year, from_month, from_day, 0, 0, 0).isoformat()
                                to_date = datetime.datetime(to_year, to_month, to_day+1, 0, 0, 0).isoformat()

                                result = LL_Voyages().Week_Time(from_date, to_date)
                                employee_list = LL_Employee().EmployeesVoyagesInSpecificWeek(ssn, result)

                                for voyage in employee_list:

                                    print('{:>22} {} {:<22}'.format(voyage.flightOut.flightNumber, '-', voyage.flightBack.flightNumber))
                                    print('.'*44,'\n')
                                    print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightOut.departingFrom, voyage.flightOut.arrivingAt, voyage.flightOut.departure, voyage.flightOut.arrival))
                                    print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightBack.departingFrom, voyage.flightBack.arrivingAt, voyage.flightBack.departure, voyage.flightBack.arrival))
                                    print('Crew: \n\tCaptain: {} \n\tCopilot: {} \n\tfsm: {} \n\tfa1: {} \n\tfa2: {}'.format(voyage.captain, voyage.copilot, voyage.fsm, voyage.fa1, voyage.fa2))
                                    print()
Esempio n. 4
0
    def EmployeesWorking(self, start_time):
        '''Returns a dict of people working on specific day'''
        new_date = start_time.split('T')
        voyages = LL_Voyages().get_voyage_list()
        employees = LL_Employee().get_crew_list()
        employee_dict = {}
        for crewMember in employees:
            for voyage in voyages:
                if crewMember.ssn in [
                        voyage.captain, voyage.copilot, voyage.fsm, voyage.fa1,
                        voyage.fa2
                ]:
                    if new_date[0] in voyage.flightOut.departure or new_date[
                            0] in voyage.flightBack.arrival:
                        employee_dict[crewMember] = voyage

        return employee_dict
Esempio n. 5
0
 def availableAircrafts(self, start_time):
     '''Returns a list of aircrafts available on a specific day'''
     new_date = start_time.split("T")
     voyages = LL_Voyages().get_voyage_list()
     aircrafts = self.get_aircrafts_list()
     result_aircraft = []
     continue_i = ContinueI()
     for line in aircrafts:
         try:
             for voyage in voyages:
                 if line.planeInsignia in [voyage.flightOut.aircraftID]:
                     if new_date[
                             0] in voyage.flightOut.departure or new_date[
                                 0] in voyage.flightBack.arrival:
                         raise continue_i
         except ContinueI:
             continue
         result_aircraft.append(line)
     return result_aircraft
Esempio n. 6
0
 def listVoyage(self):
     ''' prints all voyages '''
     result = LL_Voyages().get_voyage_list()
     if len(result) == 0:
         print(":: No Voyage on selected date ::")
     else:
         for voyage in result:
             status_now = self.VoyageStatusNow(voyage)
             crew_status = self.VoyageCrewStatus(voyage)
             print('{:>22} {} {:<22}'.format(voyage.flightOut.flightNumber, '-', voyage.flightBack.flightNumber))
             print('.'*44,'\n')
             print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightOut.departingFrom, voyage.flightOut.arrivingAt, voyage.flightOut.departure, voyage.flightOut.arrival))
             print()
             print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightBack.departingFrom, voyage.flightBack.arrivingAt, voyage.flightBack.departure, voyage.flightBack.arrival))
             if crew_status == True:
                 print('Crew: \n\tCaptain: {} \n\tCopilot: {} \n\tfsm: {} \n\tfa1: {} \n\tfa2: {}'.format(voyage.captain, voyage.copilot, voyage.fsm, voyage.fa1, voyage.fa2))
             else:
                 print()
                 print(crew_status)
             print('\nStatus: \n\t{}'.format(status_now))
             print()
Esempio n. 7
0
 def listByDateFilter(self):
     ''' prints all voyages on a specific day '''
     year_input = input("Year: ")
     year = LL_Employee().checkIfValidDate(year_input)
     if year == None:
         print("\n:: Not a valid year::")
     else:
         month_input = input("Month: ")
         month = LL_Employee().checkIfValidDate(month_input)
         if month == None:
             print("\n:: Not a valid month ::")
         else:
             day_input = input("Day: ")
             day = LL_Employee().checkIfValidDate(day_input)
             if day == None:
                 print("\n:: Not a valid day ::")
             else:
                 print()
                 date_time = datetime.datetime(year, month, day, 0, 0, 0).isoformat()
                 result = LL_Voyages().Date_Time(date_time)
                 print()
                 if len(result) == 0:
                     print(":: No Voyage on selected date ::")
                 else:
                     for voyage in result:
                         status_now = self.VoyageStatusNow(voyage)
                         crew_status = self.VoyageCrewStatus(voyage)
                         print('{:>22} {} {:<22}'.format(voyage.flightOut.flightNumber, '-', voyage.flightBack.flightNumber))
                         print('.'*44,'\n')
                         print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightOut.departingFrom, voyage.flightOut.arrivingAt, voyage.flightOut.departure, voyage.flightOut.arrival))
                         print()
                         print('{}-{}: \n\t{} \n\t{}'.format(voyage.flightBack.departingFrom, voyage.flightBack.arrivingAt, voyage.flightBack.departure, voyage.flightBack.arrival))
                         if crew_status == True:
                             print('Crew: \n\tCaptain: {} \n\tCopilot: {} \n\tfsm: {} \n\tfa1: {} \n\tfa2: {}'.format(voyage.captain, voyage.copilot, voyage.fsm, voyage.fa1, voyage.fa2))
                         else:
                             print()
                             print(crew_status)
                         print('\nStatus: \n\t{}'.format(status_now))
                         print()
Esempio n. 8
0
 def EmployeesNotWorking(self, start_time):
     '''Returns a list of people not working on specific day'''
     new_date = start_time.split('T')
     voyages = LL_Voyages().get_voyage_list()
     employees = self.get_crew_list()
     result_employees = []
     continue_i = ContinueI()
     for crewMember in employees:
         try:
             for voyage in voyages:
                 if crewMember.ssn in [
                         voyage.captain, voyage.copilot, voyage.fsm,
                         voyage.fa1, voyage.fa2
                 ]:
                     if new_date[
                             0] in voyage.flightOut.departure or new_date[
                                 0] in voyage.flightBack.arrival:
                         raise continue_i
         except ContinueI:
             continue
         result_employees.append(crewMember)
     return result_employees
Esempio n. 9
0
 def checkIfValidFlightTime(self, date_time):
     return LL_Voyages().checkIfValidFlightTime(date_time)
Esempio n. 10
0
 def checkIfValidFlightNumber(self, flightNumber):
     return LL_Voyages().checkIfValidFlightNumber(flightNumber)
Esempio n. 11
0
 def get_dest_id_list(self):
     return LL_Voyages().get_dest_id_list()
Esempio n. 12
0
 def create_flight(self, flightNumber, arrivingAt, date_time_ofDeparture,
                   aircraftID):
     return LL_Voyages().create_flight(flightNumber, arrivingAt,
                                       date_time_ofDeparture, aircraftID)
Esempio n. 13
0
 def Week_Time(self, from_date, to_date):
     return LL_Voyages().Week_Time(from_date, to_date)
Esempio n. 14
0
 def Date_Time(self, datetime):
     return LL_Voyages().Date_Time(datetime)
Esempio n. 15
0
 def VoyageStatusNow(self, voyage):
     ''' Prints out the status of a voyage now '''
     check_status = LL_Voyages().checkVoyageStatus(voyage)
     return check_status
Esempio n. 16
0
 def update_voyage_list(self, voyage_To_update):
     return LL_Voyages().update_voyage_list(voyage_To_update)
Esempio n. 17
0
 def get_upcomingFlight_list(self):
     return LL_Voyages().get_upcomingFlight_list()
Esempio n. 18
0
    def add_crew_to_voyage(self):
        '''Adds crew members to already existing voyage'''
        voyage_To_update = input("Enter flight number: ")
        
        update = LL_Voyages().update_voyage_list(voyage_To_update)
        voyage_list = LL_Voyages().get_upcomingFlight_list()

        if update:
            for elem in voyage_list:
                if elem.flightOut.flightNumber == voyage_To_update or elem.flightBack.flightNumber == voyage_To_update:

                    captain_list = LL_Employee().CaptainNotWorking(elem.flightOut.departure)
                    cap_with_lisence = LL_Employee().PilotWithLisence(captain_list, elem.flightOut.aircraftID)
                    print("\n{:^44}".format("List of available licensed Captains"))
                    print("."*44)

                    for num, emp in enumerate(cap_with_lisence):
                        print('{}: {} - {}'.format(num+1, emp.name, emp.rank))   
                    
                    print("_"*44)
                    voyage_captain = int(input("Captain: ")) 
                    captain = cap_with_lisence[voyage_captain-1]

                    copilot_list = LL_Employee().CopilotNotWorking(elem.flightOut.departure, captain)
                    copi_with_lisence = LL_Employee().PilotWithLisence(copilot_list, elem.flightOut.aircraftID)
                    print("\n{:^44}".format("List of available licensed Copilots"))
                    print("."*44)

                    for num, emp in enumerate(copi_with_lisence):
                        print('{}: {} - {}'.format(num+1, emp.name, emp.rank))   
                    
                    print("_"*44)         
                    voyage_copilot = int(input("Copilot: "))
                    copilot = copi_with_lisence[voyage_copilot-1]
                    
                    fsm_list = LL_Employee().FsmNotWorking(elem.flightOut.departure)
                    print("\n{:^44}".format("List of Flight Service Managers"))
                    print("."*44)
                    
                    for num, emp in enumerate(fsm_list):
                        print('{}: {} - {}'.format(num+1, emp.name, emp.rank))   
                    
                    print("_"*44)         
                    voyage_fsm = int(input("Flight Service Manager: "))
                    fsm = fsm_list[voyage_fsm-1]

                    fa_list = LL_Employee().FaNotWorking(elem.flightOut.departure)
                    print("\n{:^44}".format("List of Flight Attendants"))
                    print("."*44)
                    
                    for num, emp in enumerate(fa_list):
                        print('{}: {} - {}'.format(num+1, emp.name, emp.rank))   
                    
                    print("_"*44)         
                    voyage_fa1 = int(input("Flight Attendant 1: "))
                    voyage_fa2 = int(input("Flight Attendant 2: "))
                    
                    fa1 = fa_list[voyage_fa1-1]
                    fa2 = fa_list[voyage_fa2-1]
                    
                    voyage_WithCrew = Model_Voyage(elem.flightOut, elem.flightBack, captain.ssn, copilot.ssn, fsm.ssn, fa1.ssn, fa2.ssn)
                    LL_Voyages().change_voyage(voyage_WithCrew)

                    print("\n:: Crew has been added to voyage {} ::".format(voyage_To_update))

        else:
            print("\n:: Not a valid flight number or crew has \nalready been added to voyage {} ::".format(voyage_To_update))
Esempio n. 19
0
 def VoyageCrewStatus(self, voyage):
     ''' Prints out the status of the crew now'''
     check_status = LL_Voyages().checkVoyageCrewStatus(voyage)
     return check_status
Esempio n. 20
0
 def checkVoyageCrewStatus(self, voyage):
     return LL_Voyages().checkVoyageCrewStatus(voyage)
Esempio n. 21
0
 def change_voyage(self, voyage_WithCrew):
     return LL_Voyages().change_voyage(voyage_WithCrew)
Esempio n. 22
0
 def get_voyage_list(self):
     return LL_Voyages().get_voyage_list()
Esempio n. 23
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))