def gen_mentors(n_samples=15): global FK_MENTORS data = [(rand_str(), rand_str(), rand_name(), rd.choice(FK_ORGANISATIONS), now()) for i in range(n_samples)] data[0] = ('login', salted_hash('1'), rand_name(), rd.choice(FK_ORGANISATIONS), now()) FK_MENTORS = list(set(i[0] for i in data)) insert_data('Mentors', data)
def gen_teams(n_samples=10): global FK_TEAMS data = [(8 * i, rand_str(), rd.choice(FK_STUDENTS), now()) for i in range(n_samples)] FK_TEAMS = list(set(i[0] for i in data)) insert_data('Teams', data)
def gen_projects(n_samples=50): global FK_PROJECTS data = [(11 * i, rand_str(), rand_str(20), rand_str(20), rand_bool(), rand_str(), rd.choice(FK_MENTORS), now()) for i in range(n_samples)] FK_PROJECTS = list(set(i[0] for i in data)) insert_data('Projects', data)
def gen_students(n_samples=15): global FK_STUDENTS data = [(rand_str(), rand_str(), rand_name(), rand_group(), rd.choice(FK_UNIVERSITIES), rand_str(), now()) for i in range(n_samples)] FK_STUDENTS = list(set(i[0] for i in data)) insert_data('Students', data)
def gen_universities(n_samples=5): global FK_UNIVERSITIES data = [(4 * i, rand_uni_name(), now()) for i in range(n_samples)] FK_UNIVERSITIES = list(set(i[0] for i in data)) insert_data('Universities', data)
def gen_organisations(n_samples=10): global FK_ORGANISATIONS data = [(5 * i, rand_str(), rd.choice(['corporation', 'university']), rand_bool(), now()) for i in range(n_samples)] FK_ORGANISATIONS = list(set(i[0] for i in data)) insert_data('Organisations', data)
def gen_stud_proj_rel(): data = [(student, project, rd.randint(0, 10), rand_bool(), now()) for student, project in rand_diff_pairs(FK_STUDENTS, FK_PROJECTS)] insert_data('Student_Project_rel', data)
def gen_stud_team_rel(): data = [(student, team, rand_bool(), now()) for student, team in rand_diff_pairs(FK_STUDENTS, FK_TEAMS)] insert_data('Student_Team_rel', data)
def gen_team_proj_rel(n_samples=10): data = [(team, proj, rand_bool(), now()) for team, proj in rand_diff_pairs(FK_TEAMS, FK_PROJECTS)] insert_data('Team_Project_rel', data)