Skip to content

Commit

Permalink
Glob import fix (#288)
Browse files Browse the repository at this point in the history
* fix: glob imports

* chore: linting

* fix: better glob indexing

* chore: seeding config

* fix: seeder
  • Loading branch information
EwoutV authored Apr 10, 2024
1 parent 9183ee3 commit eb608de
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions backend/api/management/commands/seed_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Providers(BaseProvider):

MAX_TRIES = 1000
min_id = 1
max_id = 9_999_999_999_999_999_999_999
max_id = 999_999_999_99

min_salt = 1
max_salt = 100_000
Expand All @@ -93,7 +93,7 @@ def provide_teacher(self, errHandler, min_faculty=1, max_faculty=2, staf_prob=0.
faculty = [
fake.faculty_provider().id for _ in range(0, fake.random_int(min=min_faculty, max=max_faculty))
] # generate 1 or 2 facultys
username = f"{first}_{last}_{fake.random_int(min=self.min_salt, max=self.max_salt)}"
username = f"{first.lower()}{last.lower()}_{fake.random_int(min=self.min_salt, max=self.max_salt)}"[:12]
teacher = Teacher.objects.create(
id=id,
first_name=first,
Expand Down Expand Up @@ -127,7 +127,7 @@ def provide_assistant(self, errHandler, min_faculty=1, max_faculty=3, staf_prob=
faculty = [
fake.faculty_provider().id for _ in range(0, fake.random_int(min=min_faculty, max=max_faculty))
] # generate 1 or 2 or 3 facultys
username = f"{first}_{last}_{fake.random_int(min=self.min_salt, max=self.max_salt)}"
username = f"{first.lower()}{last.lower()}_{fake.random_int(min=self.min_salt, max=self.max_salt)}"[:12]
assistant = Assistant.objects.create(
id=id,
first_name=first,
Expand Down Expand Up @@ -161,7 +161,7 @@ def provide_student(self, errHandler, min_faculty=1, max_faculty=3, staf_prob=0.
faculty = [
fake.faculty_provider().id for _ in range(0, fake.random_int(min=min_faculty, max=max_faculty))
] # generate 1 or 2 or 3 facultys
username = f"{first}_{last}_{fake.random_int(min=self.min_salt, max=self.max_salt)}"
username = f"{first.lower()}{last.lower()}_{fake.random_int(min=self.min_salt, max=self.max_salt)}"[:12]
student = Student.objects.create(
id=id,
first_name=first,
Expand Down Expand Up @@ -491,25 +491,25 @@ def seed_data(self, amount, provider_function, update_function):
def handle(self, *args, **options):
start_time = time.time()
# TODO maybey take as option
amount_of_students = 50_000
amount_of_assistants = 300
amount_of_teachers = 500
amount_of_courses = 1_000
amount_of_projects = 1_500
amount_of_groups = 5_000
amount_of_submissions = 50_000
amount_of_file_extensions = 20
amount_of_structure_checks = 12_000

# amount_of_students = 0
# amount_of_assistants = 0
# amount_of_teachers = 0
# amount_of_courses = 0
# amount_of_projects = 30_000
# amount_of_groups = 0
# amount_of_submissions = 0
# amount_of_file_extensions = 0
# amount_of_structure_checks = 0
# amount_of_students = 50_000
# amount_of_assistants = 300
# amount_of_teachers = 500
# amount_of_courses = 1_000
# amount_of_projects = 3_000
# amount_of_groups = 9_000
# amount_of_submissions = 50_000
# amount_of_file_extensions = 20
# amount_of_structure_checks = 12_000

amount_of_students = 10
amount_of_assistants = 0
amount_of_teachers = 0
amount_of_courses = 0
amount_of_projects = 0
amount_of_groups = 0
amount_of_submissions = 0
amount_of_file_extensions = 0
amount_of_structure_checks = 0

self.seed_data(amount_of_students, fake.provide_student, update_Student_providers)
self.stdout.write(self.style.SUCCESS('Successfully seeded students!'))
Expand Down

0 comments on commit eb608de

Please sign in to comment.