Skip to content
Snippets Groups Projects
Commit 1d579cc1 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

workers in daily planning limited to staff

parent a6fb4bb0
No related branches found
No related tags found
1 merge request!117Resolve "extend worker class"
...@@ -4,13 +4,11 @@ import logging ...@@ -4,13 +4,11 @@ import logging
from operator import itemgetter from operator import itemgetter
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.http import JsonResponse from django.http import JsonResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from web.models.constants import GLOBAL_STUDY_ID
from web.models.worker_study_role import ROLE_CHOICES_DOCTOR, ROLE_CHOICES_NURSE, ROLE_CHOICES_PSYCHOLOGIST
from web.models import Appointment, AppointmentTypeLink, Worker, Availability, Holiday from web.models import Appointment, AppointmentTypeLink, Worker, Availability, Holiday
from web.models.worker_study_role import WORKER_STAFF
from web.views import e500_error from web.views import e500_error
from web.views.notifications import get_filter_locations from web.views.notifications import get_filter_locations
...@@ -303,10 +301,9 @@ def events(request, date): ...@@ -303,10 +301,9 @@ def events(request, date):
def get_workers_for_daily_planning(request): def get_workers_for_daily_planning(request):
result = Worker.objects.filter(locations__in=get_filter_locations(request.user)).filter( result = Worker.get_workers_by_worker_type(WORKER_STAFF).filter(
user__is_active=True).filter( locations__in=get_filter_locations(request.user)).filter(
Q(roles__study_id=GLOBAL_STUDY_ID) & Q( user__is_active=True).distinct()
roles__role__in=[ROLE_CHOICES_DOCTOR, ROLE_CHOICES_NURSE, ROLE_CHOICES_PSYCHOLOGIST])).distinct()
return result return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment