def create_flight(self, flightNumber, arrivingAt, date_time_ofDeparture, aircraftID): ''' Creates two model flights --> flightOut and flightBack ''' main_airport = 'KEF' ourDest = LL_Destinations().getOneDestination(arrivingAt) if ourDest == None: return "destination invalid!" hour, minu = ourDest.flighttime.split(":") time_of_landing = date_time_ofDeparture + timedelta(hours=int(hour), minutes=int(minu)) time_departure_flight_home = time_of_landing + timedelta(hours=1) time_landing_home = time_departure_flight_home + timedelta( hours=int(hour), minutes=int(minu)) flightNumber_home = flightNumber[:-1] + str(int(flightNumber[-1]) + 1) date_time_ofDeparture = date_time_ofDeparture.isoformat() time_of_landing = time_of_landing.isoformat() time_landing_home = time_landing_home.isoformat() time_departure_flight_home = time_departure_flight_home.isoformat() flight_out = Model_Flight(flightNumber, main_airport, arrivingAt, date_time_ofDeparture, time_of_landing, aircraftID) IO_VoyagesFromFile().add_new_flight_to_file(flight_out) flight_home = Model_Flight(flightNumber_home, arrivingAt, main_airport, time_departure_flight_home, time_landing_home, aircraftID) IO_VoyagesFromFile().add_new_flight_to_file(flight_home)
def get_voyage_list(self): ''' Returns a list of all voyages ''' voyage_list = IO_VoyagesFromFile().get_voyage() return voyage_list
def change_voyage(self, voyage_WithCrew): ''' Sends the voyage with the new emplyees to the datalayer ''' IO_VoyagesFromFile().add_employees(voyage_WithCrew)
def get_pastFlights_list(self): pastFlight_list = IO_VoyagesFromFile().get_pastFlights_from_file() return pastFlight_list
def get_upcomingFlight_list(self): ''' Returns a list of all upcoming flights ''' upcomingList = IO_VoyagesFromFile().get_upcomingFlights_from_file() return upcomingList
def get_upcomingFlights_list(self): upcomingFlight_list = IO_VoyagesFromFile( ).get_upcomingFlights_from_file() return upcomingFlight_list
def date_time(self): pastFlight_list = IO_VoyagesFromFile().get_pastFlights_from_file() for line in pastFlight_list: date = dateutil.parser.parse(line.departure) return date
def add_employees(self, voyage_WithCrew): return IO_VoyagesFromFile().add_employees(voyage_WithCrew)
def add_new_voyage(self, voyage_WithCrew): return IO_VoyagesFromFile().add_new_voyage(voyage_WithCrew)
def add_new_flight_to_file(self, flight): return IO_VoyagesFromFile().add_new_flight_to_file(flight)
def get_upcomingFlights_from_file(self): return IO_VoyagesFromFile().get_upcomingFlights_from_file()
def get_voyage(self): return IO_VoyagesFromFile().get_voyage()