Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
magsyg committed Nov 12, 2024
1 parent 8712910 commit c4abc08
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
22 changes: 11 additions & 11 deletions backend/samfundet/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ def get_application_count(self, application: RecruitmentApplication) -> int:


class RecruitmentPositionOrganizedApplications(CustomBaseSerializer):
applicationSerializer = RecruitmentApplicationForGangSerializer
ApplicationSerializer = RecruitmentApplicationForGangSerializer
unprocessed = serializers.SerializerMethodField(method_name='get_unprocessed', read_only=True)
withdrawn = serializers.SerializerMethodField(method_name='get_withdrawn', read_only=True)
accepted = serializers.SerializerMethodField(method_name='get_accepted', read_only=True)
Expand All @@ -1107,27 +1107,27 @@ class Meta:
model = RecruitmentPosition
fields = ['unprocessed', 'withdrawn', 'accepted', 'rejected', 'hardtoget']

def get_unprocessed(self, instance: RecruitmentPosition):
def get_unprocessed(self, instance: RecruitmentPosition): # noqa: ANN201
unprocessed = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.NOT_SET)
return self.applicationSerializer(unprocessed, many=True).data
return self.ApplicationSerializer(unprocessed, many=True).data

def get_withdrawn(self, instance: RecruitmentPosition):
def get_withdrawn(self, instance: RecruitmentPosition): # noqa: ANN201
withdrawn = instance.applications.filter(withdrawn=True)
return self.applicationSerializer(withdrawn, many=True).data
return self.ApplicationSerializer(withdrawn, many=True).data

def get_rejected(self, instance: RecruitmentPosition):
def get_rejected(self, instance: RecruitmentPosition): # noqa: ANN201
rejected = instance.applications.filter(
withdrawn=False, recruiter_status__in=[RecruitmentStatusChoices.AUTOMATIC_REJECTION, RecruitmentStatusChoices.REJECTION]
)
return self.applicationSerializer(rejected, many=True).data
return self.ApplicationSerializer(rejected, many=True).data

def get_accepted(self, instance: RecruitmentPosition):
def get_accepted(self, instance: RecruitmentPosition): # noqa: ANN201
accepted = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.CALLED_AND_ACCEPTED)
return self.applicationSerializer(accepted, many=True).data
return self.ApplicationSerializer(accepted, many=True).data

def get_hardtoget(self, instance: RecruitmentPosition):
def get_hardtoget(self, instance: RecruitmentPosition): # noqa: ANN201
hardtoget = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.CALLED_AND_REJECTED)
return self.applicationSerializer(hardtoget, many=True).data
return self.ApplicationSerializer(hardtoget, many=True).data


class RecruitmentApplicationUpdateForGangSerializer(serializers.Serializer):
Expand Down
2 changes: 1 addition & 1 deletion backend/samfundet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
from .homepage import homepage
from .models.role import Role
from .serializers import (
RecruitmentPositionOrganizedApplications,
TagSerializer,
GangSerializer,
MenuSerializer,
Expand Down Expand Up @@ -88,6 +87,7 @@
RecruitmentSeparatePositionSerializer,
RecruitmentApplicationForGangSerializer,
RecruitmentUpdateUserPrioritySerializer,
RecruitmentPositionOrganizedApplications,
RecruitmentPositionForApplicantSerializer,
RecruitmentInterviewAvailabilitySerializer,
RecruitmentApplicationForApplicantSerializer,
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/routes/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,6 @@ export const ROUTES_BACKEND = {
samfundet__recruitment_applications_for_position_detail: '/api/recruitment-applications-for-position/:pk/',
samfundet__interview_list: '/api/interview/',
samfundet__interview_detail: '/api/interview/:pk/',
samfundet__api_root: '/api/',
samfundet__api_root: '/api/:format',
samfundet__schema: '/schema/',
samfundet__swagger_ui: '/schema/swagger-ui/',
samfundet__redoc: '/schema/redoc/',
Expand Down Expand Up @@ -610,4 +608,4 @@ export const ROUTES_BACKEND = {
samfundet__purchase_feedback: '/purchase-feedback/',
static__path: '/static/:path',
media__path: '/media/:path',
} as const;
} as const;

0 comments on commit c4abc08

Please sign in to comment.