def __get_employee_list(search, filter, time): '''Private method which gets the employee list according to the filter and search.''' employee_list = IO_API.get_data("employee") # Checks the filter filtered_employee_list = [] if filter == "pilot" or filter == "cabin_crew": for employee in employee_list: if employee.get_job() == filter: filtered_employee_list += [employee] elif filter == "all": filtered_employee_list = employee_list else: all_voyages = IO_API.get_data("voyage") same_day_voyages = [] for voyage in all_voyages: for work_day in Voyage_LL.get_voyage_working_days(voyage): if work_day.year == time.year and work_day.month == time.month and work_day.day == time.day: same_day_voyages += [voyage] if filter == "working": filtered_employee_list = [] for voyage in same_day_voyages: for ssn in voyage.get_employee_ids(): filtered_employee_list += [Voyage_LL.get_employee_by_id(ssn)] elif filter == "not_working": working = [] for voyage in same_day_voyages: for ssn in voyage.get_employee_ids(): working += [Voyage_LL.get_employee_by_id(ssn)] filtered_employee_list = list(set(employee_list)-set(working)) employee_list = filtered_employee_list # Checks the search if search != None: search_filtered_employee_list = [] for employee in employee_list: if search.lower() in Employee_LL.get_list_info(employee).lower(): search_filtered_employee_list.append(employee) else: search_filtered_employee_list = employee_list return search_filtered_employee_list
def get_working_employees(time): all_voyages = IO_API.get_data("voyage") same_day_voyages = [] for voyage in all_voyages: for work_day in Voyage_LL.get_voyage_working_days(voyage): if work_day.year == time.year and work_day.month == time.month and work_day.day == time.day: same_day_voyages += [voyage] working_employee_list = [] for voyage in same_day_voyages: for ssn in voyage.get_employee_ids(): working_employee_list += [Voyage_LL.get_employee_by_id(ssn)] return working_employee_list