def __get_voyage_list(search, search_filter): all_voyage_list = IO_API.get_data("voyage") old_voyages = Voyage_LL.voyages_status_checker(all_voyage_list) all_voyage_list = [ voyage for voyage in all_voyage_list if voyage not in old_voyages ] IO_API.write_data("voyage", all_voyage_list) # Search filter if search != None: search_filtered_voyage_list = [] for voyage in all_voyage_list: if search.lower() in Voyage_LL.get_list_info(voyage).lower(): search_filtered_voyage_list += [voyage] else: search_filtered_voyage_list = all_voyage_list # search_filter can be ["all", "not_finished", "finished", "manned", "unmanned"] if search_filter == "all": search_filter_filtered_voyage_list = search_filtered_voyage_list + Old_Voyage_LL.get_old_voyages_list( search) elif search_filter == "not finished": search_filter_filtered_voyage_list = search_filtered_voyage_list elif search_filter == "finished": search_filter_filtered_voyage_list = Old_Voyage_LL.get_old_voyages_list( search) else: search_filter_filtered_voyage_list = [] for voyage in search_filtered_voyage_list: ##print(voyage.get_crew_status(), search_filter) if voyage.get_crew_status() == search_filter: search_filter_filtered_voyage_list += [voyage] return search_filter_filtered_voyage_list
def change_voyage(voyage_ID, new_info): full_voyage_list = IO_API.get_data("voyage") for voyage in full_voyage_list: if voyage.get_id() == voyage_ID: voyage.set_info(new_info) break IO_API.write_data("voyage", full_voyage_list)
def change_employee(employee_ID, new_employee_info): '''Stores the changes of an employee.''' all_employees = IO_API.get_data("employee") for employee in all_employees: if employee.get_id() == employee_ID: employee.set_info(new_employee_info) IO_API.write_data("employee", all_employees)
def change_destination(destination_ID, new_destination_info): '''Stores the changes of a destination.''' all_destinations = IO_API.get_data("destination") for destination in all_destinations: if destination.get_id() == destination_ID: destination.set_info(new_destination_info) IO_API.write_data("destination", all_destinations)
def write_aircraft_list(aircraft_list): IO_API.write_data(Aircraft_LL.AIRCRAFT_ID, aircraft_list)