def read_position(filename): table = file_handling.import_data(filename) # import table id = ui.user_input("Please give me the position's ID", ["ID: "]) # user input, ID titles = ["ID", "Description", "Number of seats", "Company ID"] filtered_table = [] for record in table: if record[0] == id[0]: filtered_table.append(record) ui.print_table(filtered_table, titles)
def read_company(filename, pos_file): table = file_handling.import_data(filename) # import table pos_table = file_handling.import_data(pos_file) # import positions table id = ui.user_input("Please give me the ID of the company",["ID: "]) # user input, ID titles = ["ID", "Name"] titles_2 = ["Positions ID", "Description", "Seats", "Company ID"] filtered_table = [] pos_filtered_table = [] for record in table: if record[0] == id[0]: filtered_table.append(record) ui.print_table(filtered_table, titles) for record in pos_table: if record[3] == filtered_table[0][0]: pos_filtered_table.append(record) if len(pos_filtered_table) != 0: ui.print_table(pos_filtered_table, titles_2)
def read_student(st_file, app_file): st_table = file_handling.import_data(st_file) # import students table app_table = file_handling.import_data(app_file) # import application table id = ui.user_input("Please give me the student's ID", ["ID: "]) # user input, ID titles = ["Students ID", "Name", "Age", "Status"] titles_2 = ["Application ID", "Accepted", "Student ID", "Position ID"] filtered_table = [] app_filtered_table = [] for record in st_table: if record[0] == id[0]: filtered_table.append(record) ui.print_table(filtered_table, titles) for record in app_table: if record[2] == filtered_table[0][0]: app_filtered_table.append(record) if len(app_filtered_table) != 0: ui.print_table(app_filtered_table, titles_2)
def read_students(filename): table = file_handling.import_data(filename) titles = ["ID", "Name", "Age", "Status"] ui.print_table(table, titles)
def read_companies(filename): table = file_handling.import_data(filename) titles = ["ID", "Name"] ui.print_table(table, titles)