Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/frontend/store2-2.…
Browse files Browse the repository at this point in the history
…14.4
  • Loading branch information
Snorre98 authored Feb 8, 2025
2 parents 466044b + 9a1c944 commit f5a48fb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions backend/samfundet/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
name='recruitment_download_gang_application_csv',
),
path('occupiedtimeslot/', views.OccupiedTimeslotView.as_view(), name='occupied_timeslots'),
path(
'recruitment/<int:recruitment_id>/interviewer-availability/', views.InterviewerAvailabilityForDate.as_view(), name='interviewer-availability-for-date'
),
path('recruitment-interview-availability/', views.RecruitmentInterviewAvailabilityView.as_view(), name='recruitment_interview_availability'),
path('recruitment/<int:id>/availability/', views.RecruitmentAvailabilityView.as_view(), name='recruitment_availability'),
path('feedback/', views.UserFeedbackView.as_view(), name='feedback'),
Expand Down
22 changes: 20 additions & 2 deletions backend/samfundet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import hmac
import hashlib
from typing import Any
from datetime import datetime
from itertools import chain

from guardian.shortcuts import get_objects_for_user
Expand Down Expand Up @@ -1214,7 +1215,7 @@ def get(
recruitment = get_object_or_404(Recruitment, id=recruitment_id)
applications = RecruitmentApplication.objects.filter(recruitment=recruitment)

filename = f"opptak_{recruitment.name_nb}_{recruitment.organization.name}_{timezone.now().strftime('%Y-%m-%d %H.%M')}.csv"
filename = f'opptak_{recruitment.name_nb}_{recruitment.organization.name}_{timezone.now().strftime("%Y-%m-%d %H.%M")}.csv'
response = HttpResponse(
content_type='text/csv',
headers={'Content-Disposition': f'Attachment; filename="{filename}"'},
Expand Down Expand Up @@ -1273,7 +1274,7 @@ def get(
gang = get_object_or_404(Gang, id=gang_id)
applications = RecruitmentApplication.objects.filter(recruitment_position__gang=gang, recruitment=recruitment)

filename = f"opptak_{gang.name_nb}_{recruitment.name_nb}_{recruitment.organization.name}_{timezone.now().strftime('%Y-%m-%d %H.%M')}.csv"
filename = f'opptak_{gang.name_nb}_{recruitment.name_nb}_{recruitment.organization.name}_{timezone.now().strftime("%Y-%m-%d %H.%M")}.csv'
response = HttpResponse(
content_type='text/csv',
headers={'Content-Disposition': f'Attachment; filename="{filename}"'},
Expand Down Expand Up @@ -1495,3 +1496,20 @@ def get(self, request: Request, recruitment_id: int, gang_id: int) -> Response:
'total_rejected': gang_stat.total_rejected,
}
)


class InterviewerAvailabilityForDate(APIView):
permission_classes = [IsAuthenticated]

def get(self, request: Request, recruitment_id: int) -> Response:
date = datetime.fromisoformat(request.query_params.get('date'))
interviewers = request.query_params.get('interviewers', [])

return Response(
OccupiedTimeslot.objects.filter(
recruitment__id=recruitment_id,
user__in=interviewers,
start_dt__date__lte=date,
end_dt__date__gte=date,
)
)

0 comments on commit f5a48fb

Please sign in to comment.