Beispiel #1
0
def list_all_aircraft():

    #fall sem nær i allar flugvelar

    skra1 = 'AircraftType copy.csv'
    skra2 = 'AircraftCopy.csv'

    file2 = OpenFile(skra2)

    aircraft = []

    with file2 as csv_file:
        csv_reader2 = csv.DictReader(csv_file)
        for row1 in csv_reader2:
            insignia = row1["planeInsignia"]
            planeType = row1["planeTypeId"]
            file1 = OpenFile(skra1)
            with file1 as csv_file:
                csv_reader1 = csv.DictReader(csv_file)
                for row in csv_reader1:
                    if row['planeTypeId'] == planeType:
                        air1 = createAirplane(
                            row['planeTypeId'], row['manufacturer'],
                            row['model'], row['capacity'], row['emptyWeight'],
                            row['maxTakeoffWeight'], row['unitThrust'],
                            row['serviceCeiling'], row['length'],
                            row['height'], row['wingspan'])
                        air1.planeInsignia = insignia
                        aircraft.append(air1)

    return aircraft
def saveUpdatedAircraft(aircraft):

    #fall sem skrifar inn uppfærðar upplýsingar um flugvél í skrá
    air=[]
    ##path="/Users/valdisbaerings/Documents/github/verklegt_namskeid_1/csvFiles/AircraftTypeCopy.csv"

    file = OpenFile('AircraftTypeCopy.csv')

    with file as File1:
        csv_reader = csv.DictReader(File1)
        for row in csv_reader:
            airc = createStaff(row['planeTypeId'],row['manufacturer'],row['model'],row['capacity'],'emptyWeight',row['maxTakeoffWeight'],row['unitThrust'],row['serviceCeiling'],row['length'],row['height'],row['wingspan'])
            air.append(airc)
    File1.close()

    absPathFile = os.path.abspath(__file__)
    fileDir = os.path.dirname(os.path.abspath(__file__))
    parentDir = os.path.dirname(fileDir)
    path = parentDir + "/csvFiles/AircraftTypeCopy.csv"

    f=open(path, 'w')

    writer = csv.writer(f)
    writer.writerow( ('planeTypeId','manufacturer','model','capacity','emptyWeight','maxTakeoffWeight','unitThrust','serviceCeiling','length','height','wingspan') )

    for i in range(len(aircraft)):
        if air[i].SSN==aircraft.SSN:
            writer.writerow((aircraft.SSN,aircraft.name,aircraft.role,aircraft.rank,aircraft.licence,aircraft.address,aircraft.phoneNumber))
        else:
            writer.writerow((air[i].SSN,air[i].name,air[i].role,air[i].rank,air[i].licence,air[i].address,air[i].phoneNumber))
def saveUpdatedStaff(employee):

    #fallið opnar skrá og skrifar inn uppfærðar upplýsingar

    staff=[]
    ##path="/Users/valdisbaerings/Documents/github/verklegt_namskeid_1/csvFiles/CrewCopy.csv"

    file = OpenFile('CrewCopy.csv')

    with file as File1:
        csv_reader = csv.DictReader(File1)
        for row in csv_reader:
            empl = createStaff(row['name'],row['ssn'],row['address'],row['phonenumber'],'email',row['rank'],row['role'], row['licence'])
            staff.append(empl)
    File1.close()

    absPathFile = os.path.abspath(__file__)
    fileDir = os.path.dirname(os.path.abspath(__file__))
    parentDir = os.path.dirname(fileDir)
    path = parentDir + "/csvFiles/CrewCopy.csv"

    f=open(path, 'w')

    writer = csv.writer(f)
    writer.writerow( ('ssn', 'name', 'role','rank','licence','address','phonenumber') )

    for i in range(len(staff)):
        if staff[i].SSN==employee.SSN:
            writer.writerow((employee.SSN,employee.name,employee.role,employee.rank,employee.licence,employee.address,employee.phoneNumber))
        else:
            writer.writerow((staff[i].SSN,staff[i].name,staff[i].role,staff[i].rank,staff[i].licence,staff[i].address,staff[i].phoneNumber))
Beispiel #4
0
def aircraftToVoyage(voyage):

    #fall sem vistar flugvél á vinnuferð í skrá

    voy = []
    ##path="/Users/valdisbaerings/Documents/github/verklegt_namskeid_1/csvFiles/UpcomingFlights copy3.csv"
    departRoute = voyage.departureFlight
    retRoute = voyage.returnFlight

    file = OpenFile('UpcomingFlights copy3.csv')

    with open(file, 'r') as File1:
        csv_reader = csv.DictReader(File1)
        for row in csv_reader:
            v = createFlightRoute(row['flightNumber'], row['departingFrom'],
                                  row['arrivingAt'], row['departure'],
                                  row['arrival'], row['aircraftID'],
                                  row['soldTickets'], row['captain'],
                                  row['copilot'], row['fsm'], row['fa1'],
                                  row['fa2'])
            if v.flightNumber == departRoute.flightNumber and v.departure == departRoute.departure:
                voy.append(departRoute)
            elif v.flightNumber == retRoute.flightNumber and v.departure == retRoute.departure:
                voy.append(retRoute)
            else:
                voy.append(v)
    File1.close()
    return voy
Beispiel #5
0
def airplaneCapacity(planeInsigniaIn):

    #fall sem nær í sætisfjölda fljugvélar eftir typu hennar

    insignia = []
    planeType = []
    planeType2 = []
    capacityRow = []

    fileName1 = 'AircraftCopy.csv'
    fileName2 = 'AircraftType copy.csv'
    file1 = OpenFile(fileName1)
    file2 = OpenFile(fileName2)

    with file1 as csvfile:
        reader = csv.DictReader(csvfile)
        for row in reader:
            planeType.append(row['planeTypeId'])
            insignia.append(row['planeInsignia'])
        for i in range(len(insignia)):
            if insignia[i] == planeInsigniaIn:
                TypeOut = planeType[i]
                #print(TypeOut)
            # else:
            #     TypeOut=0
    csvfile.close()

    with file2 as csvfile2:
        reader2 = csv.DictReader(csvfile2)
        for row in reader2:
            planeType2.append(row['planeTypeId'])
            capacityRow.append(row['capacity'])
        for i in range(len(planeType2)):
            if planeType2[i] == TypeOut:
                capacityOut = int(capacityRow[i])
            # else:
            #     capacityOut='UNKNOWN'
        csvfile2.close()

    return capacityOut
Beispiel #6
0
def searchPilotsByLicence(airplaneType):

    #tek inn typu flugvelar
    file1 = 'CrewCopy.csv'
    file_ = OpenFile(file1)
    allStaff = read_crew_file(file_)

    pilots = []
    #fer i gegnum alla starfsmenn og tekka hverjir passa við flugvelatypuna og by til starfsmanna klasatilvik og set i lista til að skila ut
    for i in range(len(allStaff)):
        if allStaff[i].role == 'Pilot' and allStaff[i].licence == airplaneType:
            emp = createStaff(allStaff[i].name, allStaff[i].SSN,
                              allStaff[i].address, allStaff[i].phoneNumber,
                              allStaff[i].emailAddress, allStaff[i].rank,
                              allStaff[i].role, allStaff[i].licence)
            pilots.append(emp)

    return pilots
Beispiel #7
0
def read_pastFlights(file):

    #fall sem nær í öll flug úr skrá og býr til klasatilvikalista af þeim
    pastFlights = []

    file_name = OpenFile(file)

    with file_name as csvfile:
        reader = csv.DictReader(csvfile)
        for row in reader:
            flight = createFlightRoute(row['flightNumber'],
                                       row['departingFrom'], row['arrivingAt'],
                                       row['departure'], row['arrival'],
                                       row['aircraftID'], row['soldTickets'],
                                       row['captain'], row['copilot'],
                                       row['fsm'], row['fa1'], row['fa2'])
            pastFlights.append(flight)

    return pastFlights
def saveUpVoy(voyage):
    voy=[]

    departRoute=voyage.departureFlight
    retRoute=voyage.returnFlight
    #finn viðeigandi skra
    today=now()
    if today>departRoute.departure:
        file="PastFlights copy.csv"
    else:
        file="UpcomingFlights copy3.csv"

    path = OpenFile(file)

    #opna og les uppur i lista
    with path as File1:
        csv_reader = csv.DictReader(File1)
        for row in csv_reader:
            v = createFlightRoute(row['flightNumber'],row['departingFrom'],row['arrivingAt'],row['departure'],row['arrival'],row['aircraftID'],row['soldTickets'],row['captain'],row['copilot'],row['fsm'],row['fa1'],row['fa2'])
            voy.append(v)

    absPathFile = os.path.abspath(__file__)
    fileDir = os.path.dirname(os.path.abspath(__file__))
    parentDir = os.path.dirname(fileDir)
    path = parentDir + "/csvFiles/" + file

    #bæti inni skra soldTickets
    File1.close()
    f=open(path, 'w')
    writer = csv.writer(f)
    writer.writerow( ('flightNumber','departingFrom','arrivingAt','departure','arrival','aircraftID','soldTickets','captain','copilot','fsm','fa1','fa2') )
    for i in range(len(voy)):
        if voy[i].flightNumber==departRoute.flightNumber and voy[i].departure==departRoute.departure:
            writer.writerow((departRoute.flightNumber,departRoute.departingFrom,departRoute.arrivingAt,departRoute.departure,departRoute.arrival,departRoute.aircraftId,departRoute.soldTickets,departRoute.captain,departRoute.copilot,departRoute.fsm,departRoute.fa1,departRoute.fa2))
        elif voy[i-1].flightNumber==departRoute.flightNumber and voy[i-1].departure==departRoute.departure:
            writer.writerow((retRoute.flightNumber,retRoute.departingFrom,retRoute.arrivingAt,retRoute.departure,retRoute.arrival,retRoute.aircraftId,retRoute.soldTickets,retRoute.captain,retRoute.copilot,retRoute.fsm,retRoute.fa1,retRoute.fa2))
        else:
            writer.writerow((voy[i].flightNumber,voy[i].departingFrom,voy[i].arrivingAt,voy[i].departure,voy[i].arrival,voy[i].aircraftId,voy[i].soldTickets,voy[i].captain,voy[i].copilot,voy[i].fsm,voy[i].fa1,voy[i].fa2))
    f.close()

    return voy
Beispiel #9
0
def getAllTypes():

    #fall sem nær í allar flugvélatýpur

    file1 = 'AircraftCopy.csv'

    file_ = OpenFile(file1)

    tempTypes = []
    retTypes = []

    with file_ as csv_file:
        csv_reader = csv.DictReader(csv_file)
        for row in csv_reader:
            tempTypes.append(row['planeTypeId'])

    for i in tempTypes:
        if i not in retTypes:
            retTypes.append(i)

    return retTypes
def saveUpdatedVoyage(voyage):

    voy=[]

    #by til voyage klasatilvik
    departRoute=voyage.departureFlight
    retRoute=voyage.returnFlight

    file = OpenFile('UpcomingFlights copy3.csv')

    #tek oll voyage ut skranni og bæti við nyju
    with file as File1:
        csv_reader = csv.DictReader(File1)

        for row in csv_reader:
            v = createFlightRoute(row['flightNumber'],row['departingFrom'],row['arrivingAt'],row['departure'],row['arrival'],row['aircraftID'],row['soldTickets'],row['captain'],row['copilot'],row['fsm'],row['fa1'],row['fa2'])
            voy.append(v)
        #her bæti við
        voy.append(departRoute)
        voy.append(retRoute)

    return voy
def getDestinations():

    #Fall sem nær í alla áfangastaði úr skrá

    Destination_array = []
    fjoldiAfStad = []
    listOfDest = []

    FileOpen = OpenFile("DestinationsCopy.csv")
    with FileOpen as csv_file:
        csv_reader = csv.DictReader(csv_file)
        for row in csv_reader:
            Destination = row['destination']
            Destination_array.append(Destination)
            Dest = CreateDestination(row["id"], row['destination'],
                                     row['country'], row['distance'],
                                     row['contactName'], row['contactNumber'])
            listOfDest.append(Dest)

    listOfDest.sort(key=lambda dest: dest.destination)

    return listOfDest
Beispiel #12
0
def saveUpdatedDest(dest):

    #fall sem skrifar inn uppfærðar upplýsingar um destination i skrá
    Desti = []
    ##path="/Users/valdisbaerings/Documents/github/verklegt_namskeid_1/csvFiles/DestinationsCopy.csv"

    file = OpenFile('DestinationsCopy.csv')

    with file as File1:
        csv_reader = csv.DictReader(File1)
        for row in csv_reader:
            Destination = CreateDestination(row['id'], row['destination'],
                                            row['country'], row['distance'],
                                            row['contactName'],
                                            row['contactNumber'])
            Desti.append(Destination)
    File1.close()

    absPathFile = os.path.abspath(__file__)
    fileDir = os.path.dirname(os.path.abspath(__file__))
    parentDir = os.path.dirname(fileDir)
    path = parentDir + "/csvFiles/DestinationsCopy.csv"

    f = open(path, 'w')

    writer = csv.writer(f)
    writer.writerow(('id', 'destination', 'country', 'distance', 'contactName',
                     'contactNumber'))

    for i in range(len(Desti)):
        if Desti[i].destination == dest.destination:
            writer.writerow(
                (dest.id, dest.destination, dest.country, dest.distance,
                 dest.contactName, dest.contactNumber))
        else:
            writer.writerow((Desti[i].id, Desti[i].destination,
                             Desti[i].country, Desti[i].distance,
                             Desti[i].contactName, Desti[i].contactNumber))
Beispiel #13
0
def staffInfo(input_num, input_string):

    skra='CrewCopy.csv'

    file_=OpenFile(skra)
    allStaff=read_crew_file(file_) #klasa tilvik af ollum staff i lista

    #tomur listi til að nota
    employees = []

    #fer i gegnum alla starfsmenn
    for i in range(len(allStaff)):
        if input_num==1: #ef input er 1 set eg alla starfsmenn i lista
            empl = createStaff(allStaff[i].name, allStaff[i].SSN, allStaff[i].address, allStaff[i].phoneNumber,allStaff[i].emailAddress,allStaff[i].rank,allStaff[i].role,allStaff[i].licence)
            employees.append(empl)

        elif input_num==2: #ef input er 2 finn eg starfsmenn með role pilot og set i lista
            if allStaff[i].role=='Pilot':
                empl = createStaff(allStaff[i].name, allStaff[i].SSN, allStaff[i].address, allStaff[i].phoneNumber,allStaff[i].emailAddress,allStaff[i].rank,allStaff[i].role,allStaff[i].licence)
                employees.append(empl)

        elif input_num==3: #ef input er 3 finn eg starfsmenn með role cabincrew og set i lista
            if allStaff[i].role=='Cabincrew':
                 empl = createStaff(allStaff[i].name, allStaff[i].SSN, allStaff[i].address, allStaff[i].phoneNumber,allStaff[i].emailAddress,allStaff[i].rank,allStaff[i].role,allStaff[i].licence)
                 employees.append(empl)

        elif input_num==4: #þarf að leita eftir starfsmanni eftir ssn eða name, nota leitaStaff fallið til þess, það skilar listum af kennitölum og rank sem passa við inputið (leitarorðið)
            ssn, rank = leitaStaff(input_string, allStaff)

            if ssn==0 and rank == 0: #ef eg fann engan sem passaði skila eg 0
                return 0
            else:
                for j in range(len(ssn)): #annars finn ég alla starfsmenn i allStaff lista sem passa við ssn og set i employees listann
                    if allStaff[i].SSN == ssn[j]:
                        empl = createStaff(allStaff[i].name, allStaff[i].SSN, allStaff[i].address, allStaff[i].phoneNumber,allStaff[i].emailAddress,allStaff[i].rank,allStaff[i].role,allStaff[i].licence)
                        employees.append(empl)
    #skila listanum
    return employees
Beispiel #14
0
def airportOccupied(newVoyage):
    depFlight = newVoyage.departureFlight
    retFlight = newVoyage.returnFlight
    boolAirportOccupied = False
    ##path="/Users/valdisbaerings/Documents/github/verklegt_namskeid_1/csvFiles/UpcomingFlights copy3.csv"
    voy = []
    newDateDep = newVoyage.departureFlight.departure
    newDateRet = newVoyage.returnFlight.arrival

    file = OpenFile('UpcomingFlights copy3.csv')

    with file as File1:
        csv_reader = csv.DictReader(File1)
        for row in csv_reader:
            v = createFlightRoute(row['flightNumber'], row['departingFrom'],
                                  row['arrivingAt'], row['departure'],
                                  row['arrival'], row['aircraftID'],
                                  row['soldTickets'], row['captain'],
                                  row['copilot'], row['fsm'], row['fa1'],
                                  row['fa2'])
            voy.append(v)  #Lesid ur UpcomingFlights i listann voy
            #Farid i gegnum oll flug i UpcomingFlights og departure timi borinn saman vid departure tima a flugi sem verid er ad baeta inn, ef their eru their somu er boolAirportOccupied breytt i True
            if v.departingFrom == 'KEF' and (v.departure == newDateDep
                                             or v.departure == newDateRet):
                print("The airport is already occupied")
                boolAirportOccupied = True
            elif v.arrivingAt == 'KEF' and (v.arrival == newDateDep
                                            or v.arrival == newDateRet):
                print("The airport is already occupied")
                boolAirportOccupied = True

    File1.close()
    if boolAirportOccupied == False:
        voy.append(depFlight)
        voy.append(retFlight)
        #Nyju flugunum er baett vid ef flugvollurinn er ekki fratekinn
    return voy
def emplWorking(inptDate):

    inptDay = str(inptDate[0:2])
    inptMonth = str(inptDate[3:5])
    inptYear = str(inptDate[6:10])

    #set inslegna dagsetningu a isoformat 8601
    standardDate = inptYear + '-' + inptMonth + '-' + inptDay + 'T' + '00:00:00'

    file2 = 'CrewCopy.csv'
    file = OpenFile(file2)
    allStaff = read_crew_file(file)  #listi starfsmanna

    today = now()

    #opna pastflights ef innslegin dagsetning er minni en i dag en annars upcoming flights
    if today > standardDate:
        file1 = 'PastFlights copy.csv'
    else:
        file1 = 'UpcomingFlights copy3.csv'

    allPastFlights = read_pastFlights(
        file1)  #öll flug úr þeirri skrá sem við á, klasatilvik

    #tómir listar til að nota
    updemplSSN = []
    working = []
    emplSSN = []
    employees = []
    noemployees = []
    emplDest = []
    emplLOKA = []

    #fer í gegnum öll flugin
    for j in range(len(allPastFlights)):
        #sæki daginn hverju flugi
        day = str(getDay(allPastFlights[j].departure))
        month = str(getMonth(allPastFlights[j].departure))
        year = str(getYear(allPastFlights[j].departure))

        #ef sami dagur og innsleginn set i listann emplSSN
        if inptDay == day and inptMonth == month and inptYear == year:
            emplSSN.append(allPastFlights[j].captain)
            emplSSN.append(allPastFlights[j].copilot)
            emplSSN.append(allPastFlights[j].fsm)
            emplSSN.append(allPastFlights[j].fa1)
            emplSSN.append(allPastFlights[j].fa2)

    #passa her að tvitelja ekki
    for i in emplSSN:
        if i not in updemplSSN:
            updemplSSN.append(i)

    #fer hér i gegnum alla starfsmenn og listann með kennitölum og athuga hvort eg finni sem passar og set þá í lista af starfsmannaklasatilvikum
    for j in range(len(allStaff)):
        for i in range(len(updemplSSN)):
            if allStaff[j].SSN == updemplSSN[i]:
                empl = createStaff(allStaff[j].name, allStaff[j].SSN,
                                   allStaff[j].address,
                                   allStaff[j].phoneNumber,
                                   allStaff[j].emailAddress, allStaff[j].rank,
                                   allStaff[j].role, allStaff[j].licence)
                employees.append(empl)
        #ef finn ekki þá set ég í starfsmannaklasatilvikslistan noemployees
        if allStaff[j].SSN not in updemplSSN:
            emp = createStaff(allStaff[j].name, allStaff[j].SSN,
                              allStaff[j].address, allStaff[j].phoneNumber,
                              allStaff[j].emailAddress, allStaff[j].rank,
                              allStaff[j].role, allStaff[j].licence)
            noemployees.append(emp)

    #fer aftur í gegnum öll flug til að finna hvaða kennitala á við hvaða áfangastað
    for k in range(len(allPastFlights)):
        day = str(getDay(allPastFlights[k].departure))
        month = str(getMonth(allPastFlights[k].departure))
        year = str(getYear(allPastFlights[k].departure))

        if inptDay == day and inptMonth == month and inptYear == year:
            for i in range(len(employees)):
                if employees[i].rank == 'Captain' and allPastFlights[
                        k].captain == employees[
                            i].SSN and allPastFlights[k].arrivingAt != 'KEF':
                    emplDest.append(allPastFlights[k].arrivingAt +
                                    employees[i].SSN)
                elif employees[i].rank == 'Copilot' and allPastFlights[
                        k].copilot == employees[
                            i].SSN and allPastFlights[k].arrivingAt != 'KEF':
                    emplDest.append(allPastFlights[k].arrivingAt +
                                    employees[i].SSN)
                elif employees[
                        i].rank == 'Flight Service Manager' and allPastFlights[
                            k].fsm == employees[i].SSN and allPastFlights[
                                k].arrivingAt != 'KEF':
                    emplDest.append(allPastFlights[k].arrivingAt +
                                    employees[i].SSN)
                elif employees[i].rank == 'Flight Attendant' and (
                        allPastFlights[k].fa1 == employees[i].SSN
                        or allPastFlights[k].fa2 == employees[i].SSN
                ) and allPastFlights[k].arrivingAt != 'KEF':
                    emplDest.append(allPastFlights[k].arrivingAt +
                                    employees[i].SSN)
    #geri hér til að fá á þægilegt form
    for j in range(len(allStaff)):
        for i in range(len(emplDest)):
            if allStaff[j].SSN == str(emplDest[i][3:len(emplDest[i])]):
                emplLOKA.append(allStaff[j].name + ', ' + allStaff[j].role +
                                ' - ' + str(emplDest[i][0:3]))
    #employees eru allir starfsmenn sem passa við input, noemployees eru allir starfsmenn sem passa ekki við input
    #emplLOKA er svo allir starfsmenn sem passa við input og afangastaðir þeirra
    return employees, noemployees, emplLOKA
def MostPopularDestination():

    dest_arr = []
    pastFlights_array = []
    upcFlights_array = []
    PopularDest = []

    #path='/Users/SaraLind/github/verklegt_namskeid_1/csvFiles/'

    ########### open file 1 ###########
    skra1 = 'DestinationsCopy.csv'
    file1 = OpenFile(skra1)
    allDest = getDestinations()

    #by til lista af öllum destination sem eru ekki KEF
    for i in range(len(allDest)):
        if allDest[i].id != 'KEF':
            Destination = allDest[i].id
            dest_arr.append(Destination)
    length = len(dest_arr)

    ########### open file 2 ###########
    skra2 = 'PastFlights copy.csv'
    #file2 = OpenFile(skra2)

    allPastFlights = read_pastFlights(skra2)
    #by til lista af öllum destination ur pastflights
    for i in range(len(allPastFlights)):
        if allPastFlights[i].departingFrom == 'KEF':
            pastFlights = allPastFlights[i].arrivingAt
            pastFlights_array.append(pastFlights)

    ########### open file 3 ###########
    skra3 = 'UpcomingFlights copy3.csv'

    allUPcFlights = read_pastFlights(skra3)
    #by til lista af öllum destination ur upcomingflights
    for i in range(len(allUPcFlights)):
        if allUPcFlights[i].departingFrom == 'KEF':
            upcFlights = allUPcFlights[i].arrivingAt
            upcFlights_array.append(upcFlights)

    ########### Find the most popular destination ###########
    #set saman listana
    PopularDest = pastFlights_array + upcFlights_array

    counter = []
    largest = 0
    TheCounter = 0
    count = 0

    for i in range(length):
        counter.append(0)

    #fer gegnum allt til að finna hvaða afangastaður kemur oftast fyrir
    for i in range(length - 1):
        for j in range(len(PopularDest)):
            if dest_arr[i] == PopularDest[j]:
                counter[i] += 1
    #Find the largest value
    for i in range(length - 1):
        if counter[i] > largest:
            largest = counter[i]

    #Find the location of biggest value
    for i in range(length - 1):
        if counter[i] == largest:
            count = TheCounter
        TheCounter += 1

    #Find the most popular destination
    mostPopular = dest_arr[count]

    return mostPopular
Beispiel #17
0
def staffInfo2(input_string):

    skra1 = 'CrewCopy.csv'
    skra2 = 'PastFlights copy.csv'
    skra3 = 'UpcomingFlights copy3.csv'

    skra = OpenFile(skra1)

    allStaff = read_crew_file(skra)  #listi allra starfsmanna

    employees = []
    numOfupcDest = []
    numOfpastDest = []
    pastFlights = []
    upcFlights = []

    for i in range(len(allStaff)):  #fer í gegnum alla starfsmenn
        ssn, rank = leitaStaff(
            input_string, allStaff
        )  #skilar listum af kennitölum og rank starfsm sem passa við input
        for j in range(len(ssn)):  #fer i gegnum listann ssn
            if allStaff[i].SSN == ssn[
                    j]:  #ber saman kennitölur ur báðum listum og by til kasatilvik af starfsmönnum sem passa við input
                empl = createStaff(allStaff[i].name, allStaff[i].SSN,
                                   allStaff[i].address,
                                   allStaff[i].phoneNumber,
                                   allStaff[i].emailAddress, allStaff[i].rank,
                                   allStaff[i].role, allStaff[i].licence)
                employees.append(
                    empl
                )  #by til lista af öllum starfsmönnum sem passa við inputið
                break

    allUpcFlights = read_pastFlights(skra3)  #öll upcomingflights

    #Upcoming flights
    for i in range(
            len(employees)):  #fer í gegnum alla starfsmenn sem passa við input
        for j in range(len(allUpcFlights)):  #í gegnum öll upcoming flights

            deptTime = str(getDay(allUpcFlights[j].departure)) + '/' + str(
                getMonth(allUpcFlights[j].departure)) + '/' + str(
                    getYear(allUpcFlights[j].departure)) + ' at ' + str(
                        getHour(allUpcFlights[j].departure)) + ':' + str(
                            getMinute(allUpcFlights[j].departure))
            arvlTime = str(getDay(allUpcFlights[j].arrival)) + '/' + str(
                getMonth(allUpcFlights[j].arrival)) + '/' + str(
                    getYear(allUpcFlights[j].arrival)) + ' at ' + str(
                        getHour(allUpcFlights[j].arrival)) + ':' + str(
                            getMinute(allUpcFlights[j].arrival))
            #fæ departure tima og arrival tima a akjosanlegu formati

            #ef rank starfsmans er flight attendant og eg finn hann a viðeigandi stað i upcoming flights þa buum við til
            #klasatilvik fluginu og set í upc flights.
            if employees[i].rank == 'Flight Attendant' and employees[
                    i].SSN in (allUpcFlights[j].fa1 or allUpcFlights[j].fa2):
                flight = createFlightRoute(
                    allUpcFlights[j].flightNumber,
                    allUpcFlights[j].departingFrom,
                    allUpcFlights[j].arrivingAt, deptTime, arvlTime,
                    allUpcFlights[j].aircraftId, allUpcFlights[j].soldTickets,
                    allUpcFlights[j].captain, allUpcFlights[j].copilot,
                    allUpcFlights[j].fsm, allUpcFlights[j].fa1,
                    allUpcFlights[j].fa2)
                upcFlights.append(flight)

            #Geri nakvæmlega sama fyrir allt mögulegt rank starfsmanna
            elif employees[i].rank == 'Flight Service Manager' and employees[
                    i].SSN in allUpcFlights[j].fsm:
                flight = createFlightRoute(
                    allUpcFlights[j].flightNumber,
                    allUpcFlights[j].departingFrom,
                    allUpcFlights[j].arrivingAt, deptTime, arvlTime,
                    allUpcFlights[j].aircraftId, allUpcFlights[j].soldTickets,
                    allUpcFlights[j].captain, allUpcFlights[j].copilot,
                    allUpcFlights[j].fsm, allUpcFlights[j].fa1,
                    allUpcFlights[j].fa2)
                upcFlights.append(flight)

            elif employees[i].rank == 'Captain' and employees[
                    i].SSN in allUpcFlights[j].captain:
                flight = createFlightRoute(
                    allUpcFlights[j].flightNumber,
                    allUpcFlights[j].departingFrom,
                    allUpcFlights[j].arrivingAt, deptTime, arvlTime,
                    allUpcFlights[j].aircraftId, allUpcFlights[j].soldTickets,
                    allUpcFlights[j].captain, allUpcFlights[j].copilot,
                    allUpcFlights[j].fsm, allUpcFlights[j].fa1,
                    allUpcFlights[j].fa2)
                upcFlights.append(flight)

            elif employees[i].rank == 'Copilot' and employees[
                    i].SSN in allUpcFlights[j].copilot:
                flight = createFlightRoute(
                    allUpcFlights[j].flightNumber,
                    allUpcFlights[j].departingFrom,
                    allUpcFlights[j].arrivingAt, deptTime, arvlTime,
                    allUpcFlights[j].aircraftId, allUpcFlights[j].soldTickets,
                    allUpcFlights[j].captain, allUpcFlights[j].copilot,
                    allUpcFlights[j].fsm, allUpcFlights[j].fa1,
                    allUpcFlights[j].fa2)
                upcFlights.append(flight)

        numOfupcDest.append(len(upcFlights))

    allPastFlights = read_pastFlights(skra2)

    #Nakvæmlega sama gert fyrir past flights
    #Past flights
    for i in range(len(employees)):
        for j in range(len(allPastFlights)):

            deptTime = str(getDay(allPastFlights[j].departure)) + '/' + str(
                getMonth(allPastFlights[j].departure)) + '/' + str(
                    getYear(allPastFlights[j].departure)) + ' at ' + str(
                        getHour(allPastFlights[j].departure)) + ':' + str(
                            getMinute(allPastFlights[j].departure))
            arvlTime = str(getDay(allPastFlights[j].arrival)) + '/' + str(
                getMonth(allPastFlights[j].arrival)) + '/' + str(
                    getYear(allPastFlights[j].arrival)) + ' at ' + str(
                        getHour(allPastFlights[j].arrival)) + ':' + str(
                            getMinute(allPastFlights[j].arrival))

            if employees[i].rank == 'Flight Attendant' and employees[
                    i].SSN in (allPastFlights[j].fa1 or allPastFlights[j].fa2):
                flight = createFlightRoute(
                    allPastFlights[j].flightNumber,
                    allPastFlights[j].departingFrom,
                    allPastFlights[j].arrivingAt, deptTime, arvlTime,
                    allPastFlights[j].aircraftId,
                    allPastFlights[j].soldTickets, allPastFlights[j].captain,
                    allPastFlights[j].copilot, allPastFlights[j].fsm,
                    allPastFlights[j].fa1, allPastFlights[j].fa2)
                pastFlights.append(flight)

            elif employees[i].rank == 'Flight Service Manager' and employees[
                    i].SSN in allPastFlights[j].fsm:
                flight = createFlightRoute(
                    allPastFlights[j].flightNumber,
                    allPastFlights[j].departingFrom,
                    allPastFlights[j].arrivingAt, deptTime, arvlTime,
                    allPastFlights[j].aircraftId,
                    allPastFlights[j].soldTickets, allPastFlights[j].captain,
                    allPastFlights[j].copilot, allPastFlights[j].fsm,
                    allPastFlights[j].fa1, allPastFlights[j].fa2)
                pastFlights.append(flight)

            elif employees[i].rank == 'Captain' and employees[
                    i].SSN in allPastFlights[j].captain:
                flight = createFlightRoute(
                    allPastFlights[j].flightNumber,
                    allPastFlights[j].departingFrom,
                    allPastFlights[j].arrivingAt, deptTime, arvlTime,
                    allPastFlights[j].aircraftId,
                    allPastFlights[j].soldTickets, allPastFlights[j].captain,
                    allPastFlights[j].copilot, allPastFlights[j].fsm,
                    allPastFlights[j].fa1, allPastFlights[j].fa2)
                pastFlights.append(flight)

            elif employees[i].rank == 'Copilot' and employees[
                    i].SSN in allPastFlights[j].copilot:
                flight = createFlightRoute(
                    allPastFlights[j].flightNumber,
                    allPastFlights[j].departingFrom,
                    allPastFlights[j].arrivingAt, deptTime, arvlTime,
                    allPastFlights[j].aircraftId,
                    allPastFlights[j].soldTickets, allPastFlights[j].captain,
                    allPastFlights[j].copilot, allPastFlights[j].fsm,
                    allPastFlights[j].fa1, allPastFlights[j].fa2)
                pastFlights.append(flight)

        numOfpastDest.append(len(pastFlights))

    return numOfpastDest, numOfupcDest, pastFlights, upcFlights, employees