2023-01-10 00:17:25 +01:00
|
|
|
import datetime
|
2023-01-16 21:59:49 +01:00
|
|
|
import random
|
2023-01-10 00:17:25 +01:00
|
|
|
|
2023-01-14 17:38:03 +01:00
|
|
|
from factory import Sequence, alchemy
|
2023-01-06 22:35:47 +01:00
|
|
|
from factory.faker import Faker
|
2023-01-14 17:38:03 +01:00
|
|
|
from factory.fuzzy import FuzzyDateTime, FuzzyInteger
|
2023-01-06 22:35:47 +01:00
|
|
|
|
2023-01-16 19:18:03 +01:00
|
|
|
from app.base.mode import ModeGroups
|
2023-01-09 22:32:58 +01:00
|
|
|
from app.dependencies import db
|
2023-01-16 19:18:03 +01:00
|
|
|
from app.examination_schedule.models import (
|
|
|
|
ExaminationSchedule,
|
|
|
|
TemporaryAvailability,
|
|
|
|
TermOfDefence,
|
|
|
|
)
|
|
|
|
from app.project_supervisor.models import ProjectSupervisor
|
2023-01-16 22:51:52 +01:00
|
|
|
from app.students.models import Group, ProjectGradeSheet, Student, YearGroup
|
2023-01-06 22:35:47 +01:00
|
|
|
|
|
|
|
|
2023-01-16 19:18:03 +01:00
|
|
|
class YearGroupFactory(alchemy.SQLAlchemyModelFactory):
|
2023-01-06 22:35:47 +01:00
|
|
|
class Meta:
|
2023-01-16 19:18:03 +01:00
|
|
|
model = YearGroup
|
2023-01-06 22:35:47 +01:00
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
2023-01-16 19:18:03 +01:00
|
|
|
name = "2022/2023"
|
|
|
|
mode = ModeGroups.STATIONARY.value
|
2023-01-06 22:35:47 +01:00
|
|
|
|
|
|
|
|
2023-01-16 19:18:03 +01:00
|
|
|
class ProjectSupervisorFactory(alchemy.SQLAlchemyModelFactory):
|
2023-01-06 22:35:47 +01:00
|
|
|
class Meta:
|
2023-01-16 19:18:03 +01:00
|
|
|
model = ProjectSupervisor
|
2023-01-06 22:35:47 +01:00
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
2023-01-16 19:18:03 +01:00
|
|
|
first_name = Faker("first_name")
|
|
|
|
last_name = Faker("last_name")
|
|
|
|
email = Faker("email")
|
2023-01-06 22:35:47 +01:00
|
|
|
limit_group = 4
|
|
|
|
|
2023-01-08 17:15:02 +01:00
|
|
|
|
2023-01-06 22:35:47 +01:00
|
|
|
class GroupFactory(alchemy.SQLAlchemyModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = Group
|
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
2023-01-14 17:38:03 +01:00
|
|
|
name = Sequence(lambda n: f"Group-{n}")
|
2023-01-16 19:18:03 +01:00
|
|
|
points_for_first_term = FuzzyInteger(1, 100)
|
|
|
|
points_for_second_term = FuzzyInteger(1, 100)
|
|
|
|
grade_for_first_term = FuzzyInteger(2, 5)
|
|
|
|
grade_for_second_term = FuzzyInteger(2, 5)
|
2023-01-06 22:35:47 +01:00
|
|
|
|
2023-01-08 17:15:02 +01:00
|
|
|
|
|
|
|
class StudentFactory(alchemy.SQLAlchemyModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = Student
|
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
2023-01-14 17:38:03 +01:00
|
|
|
first_name = Faker("first_name")
|
|
|
|
last_name = Faker("last_name")
|
|
|
|
email = Faker("email")
|
2023-01-08 17:15:02 +01:00
|
|
|
index = Sequence(lambda n: 400_000 + n)
|
|
|
|
|
|
|
|
|
2023-01-10 00:17:25 +01:00
|
|
|
class ExaminationScheduleFactory(alchemy.SQLAlchemyModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = ExaminationSchedule
|
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
2023-01-14 17:38:03 +01:00
|
|
|
title = Sequence(lambda n: f"Examination schedule {n}")
|
2023-01-10 00:17:25 +01:00
|
|
|
duration_time = 30
|
2023-01-14 17:38:03 +01:00
|
|
|
start_date = FuzzyDateTime(
|
|
|
|
datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc),
|
|
|
|
datetime.datetime(2020, 1, 5, tzinfo=datetime.timezone.utc),
|
|
|
|
)
|
|
|
|
end_date = FuzzyDateTime(
|
|
|
|
datetime.datetime(2020, 1, 10, tzinfo=datetime.timezone.utc),
|
|
|
|
datetime.datetime(2020, 1, 20, tzinfo=datetime.timezone.utc),
|
|
|
|
)
|
2023-01-16 19:18:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TermOfDefenceFactory(alchemy.SQLAlchemyModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = TermOfDefence
|
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
|
|
|
start_date = Sequence(
|
|
|
|
lambda n: datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc)
|
2023-01-16 22:51:52 +01:00
|
|
|
+ datetime.timedelta(n * 30)
|
2023-01-16 19:18:03 +01:00
|
|
|
)
|
|
|
|
end_date = Sequence(
|
|
|
|
lambda n: datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc)
|
2023-01-16 22:51:52 +01:00
|
|
|
+ datetime.timedelta(n * 30 + 30)
|
2023-01-16 19:18:03 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class TemporaryAvailabilityFactory(alchemy.SQLAlchemyModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = TemporaryAvailability
|
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
|
|
|
start_date = Sequence(
|
|
|
|
lambda n: datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc)
|
2023-01-16 22:51:52 +01:00
|
|
|
+ datetime.timedelta(n * 30)
|
2023-01-16 19:18:03 +01:00
|
|
|
)
|
|
|
|
end_date = Sequence(
|
|
|
|
lambda n: datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc)
|
2023-01-16 22:51:52 +01:00
|
|
|
+ datetime.timedelta(n * 30 + 30)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class TemporaryAvailabilityFactory(alchemy.SQLAlchemyModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = TemporaryAvailability
|
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
|
|
|
start_date = Sequence(
|
|
|
|
lambda n: datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc)
|
|
|
|
+ datetime.timedelta(n * 30)
|
|
|
|
)
|
|
|
|
end_date = Sequence(
|
|
|
|
lambda n: datetime.datetime(2020, 1, 1, tzinfo=datetime.timezone.utc)
|
|
|
|
+ datetime.timedelta(n * 30 + 30)
|
2023-01-16 19:18:03 +01:00
|
|
|
)
|
2023-01-16 21:59:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ProjectGradeSheetFactory(alchemy.SQLAlchemyModelFactory):
|
|
|
|
class Meta:
|
|
|
|
model = ProjectGradeSheet
|
|
|
|
sqlalchemy_session = db.session
|
|
|
|
|
|
|
|
presentation_required_content_1 = random.choice([0, 1, 3, 4])
|
|
|
|
presentation_required_content_2 = random.choice([0, 1, 3, 4])
|
|
|
|
presentation_was_compatible_1 = random.choice([0, 1, 3, 4])
|
|
|
|
presentation_was_compatible_2 = random.choice([0, 1, 3, 4])
|
|
|
|
presentation_showing_1 = random.choice([0, 1, 3, 4])
|
|
|
|
presentation_showing_2 = random.choice([0, 1, 3, 4])
|
|
|
|
presentation_answers_to_questions_from_committee_1 = random.choice([0, 1, 3, 4])
|
|
|
|
presentation_answers_to_questions_from_committee_2 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_project_vision_1 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_project_vision_2 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_requirements_1 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_requirements_2 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_for_clients_1 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_for_clients_2 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_for_developers_1 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_for_developers_2 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_license_1 = random.choice([0, 1, 3, 4])
|
|
|
|
documentation_license_2 = random.choice([0, 1, 3, 4])
|
|
|
|
|
|
|
|
group_work_regularity_1 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_regularity_2 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_division_of_work_1 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_division_of_work_2 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_contact_with_client_1 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_contact_with_client_2 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_management_of_risk_1 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_management_of_risk_2 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_work_methodology_1 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_work_methodology_2 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_management_of_source_code_1 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_management_of_source_code_2 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_devops_1 = random.choice([0, 1, 3, 4])
|
|
|
|
group_work_devops_2 = random.choice([0, 1, 3, 4])
|
|
|
|
|
|
|
|
products_project_complexity_of_product_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_complexity_of_product_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_access_to_application_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_access_to_application_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_security_issues_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_security_issues_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_access_to_test_application_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_access_to_test_application_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_acceptance_criteria_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_acceptance_criteria_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_expected_functionality_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_expected_functionality_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_promises_well_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_promises_well_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_has_been_implemented_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_has_been_implemented_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_is_useful_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_is_useful_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_prototype_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_prototype_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_tests_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_tests_2 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_technology_1 = random.choice([0, 1, 3, 4])
|
|
|
|
products_project_technology_2 = random.choice([0, 1, 3, 4])
|