Skip to content

Commit

Permalink
fix new imports
Browse files Browse the repository at this point in the history
  • Loading branch information
magsyg committed Jan 6, 2024
1 parent 2018737 commit 0cb9bbc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
6 changes: 3 additions & 3 deletions backend/samfundet/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
18 changes: 2 additions & 16 deletions backend/samfundet/models/recruitment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand Down
9 changes: 5 additions & 4 deletions backend/samfundet/models/tests/test_recruitment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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

0 comments on commit 0cb9bbc

Please sign in to comment.