diff --git a/backend/samfundet/conftest.py b/backend/samfundet/conftest.py index 0d02e4946..8a10e7108 100644 --- a/backend/samfundet/conftest.py +++ b/backend/samfundet/conftest.py @@ -12,7 +12,7 @@ from samfundet.constants import DEV_PASSWORD from samfundet.models.billig import BilligEvent from samfundet.models.event import Event -from samfundet.models.model_choices import EventAgeRestriction, EventTicketType +from samfundet.models.model_choices import EventAgeRestriction, EventTicketType, RecruitmentPriorityChoices, RecruitmentStatusChoices from samfundet.models.recruitment import Recruitment, RecruitmentPosition, RecruitmentAdmission from samfundet.models.general import User, Image, InformationPage, Organization, Gang, BlogPost, TextItem @@ -274,8 +274,8 @@ def fixture_recruitment_admission(fixture_user: User, fixture_recruitment_positi recruitment=fixture_recruitment, user=fixture_user, applicant_priority=1, - recruiter_priority=RecruitmentAdmission.PRIORITY_CHOICES[0][0], - recruiter_status=RecruitmentAdmission.STATUS_CHOICES[0][0], + recruiter_priority=RecruitmentPriorityChoices.NOT_SET, + recruiter_status=RecruitmentStatusChoices.NOT_SET, ) yield admission admission.delete() diff --git a/backend/samfundet/models/recruitment.py b/backend/samfundet/models/recruitment.py index 985da67c3..3e80d6abc 100644 --- a/backend/samfundet/models/recruitment.py +++ b/backend/samfundet/models/recruitment.py @@ -166,20 +166,6 @@ class RecruitmentAdmission(FullCleanSaveMixin): Interview, on_delete=models.SET_NULL, null=True, blank=True, help_text='The interview for the admission', related_name='admissions' ) - PRIORITY_CHOICES = [ - (0, 'Not Set'), - (1, 'Not Wanted'), - (2, 'Wanted'), - (3, 'Reserve'), - ] - - STATUS_CHOICES = [ - (0, 'Nothing'), - (1, 'Called and Accepted'), - (2, 'Called and Rejected'), - (3, 'Automatic Rejection'), - ] - withdrawn = models.BooleanField(default=False, blank=True, null=True) # TODO: Important that the following is not sent along with the rest of the object whenever a user retrieves its admission recruiter_priority = models.IntegerField( @@ -196,8 +182,8 @@ def save(self, *args: tuple, **kwargs: dict) -> None: If the admission is saved without an interview, try to find an interview from a shared position. """ if self.withdrawn: - self.recruiter_priority = 1 - self.recruiter_status = 3 + self.recruiter_priority = RecruitmentPriorityChoices.NOT_WANTED + self.recruiter_status = RecruitmentStatusChoices.AUTOMATIC_REJECTION if not self.interview: # Check if there is already an interview for the same user in shared positions shared_interview_positions = self.recruitment_position.shared_interview_positions.all() diff --git a/backend/samfundet/models/tests/test_recruitment.py b/backend/samfundet/models/tests/test_recruitment.py index 7a8811628..1c49469a1 100644 --- a/backend/samfundet/models/tests/test_recruitment.py +++ b/backend/samfundet/models/tests/test_recruitment.py @@ -3,6 +3,7 @@ from django.utils import timezone from django.core.exceptions import ValidationError +from samfundet.models.model_choices import RecruitmentPriorityChoices, RecruitmentStatusChoices from samfundet.models.recruitment import Recruitment, Organization, RecruitmentAdmission datetime_fields_expecting_error = [ @@ -73,11 +74,11 @@ class TestRecruitmentAdmission: def test_check_withdraw_sets_unwanted(self, fixture_recruitment_admission: RecruitmentAdmission): - assert fixture_recruitment_admission.recruiter_status == 0 - assert fixture_recruitment_admission.recruiter_priority == 0 + assert fixture_recruitment_admission.recruiter_status == RecruitmentStatusChoices.NOT_SET + assert fixture_recruitment_admission.recruiter_priority == RecruitmentPriorityChoices.NOT_SET fixture_recruitment_admission.withdrawn = True fixture_recruitment_admission.save() - assert fixture_recruitment_admission.recruiter_status == 3 - assert fixture_recruitment_admission.recruiter_priority == 1 + assert fixture_recruitment_admission.recruiter_status == RecruitmentStatusChoices.AUTOMATIC_REJECTION + assert fixture_recruitment_admission.recruiter_priority == RecruitmentPriorityChoices.NOT_WANTED