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

worker list shows list of proper worker type

parent a10a95a3
No related branches found
No related tags found
1 merge request!117Resolve "extend worker class"
...@@ -15,7 +15,14 @@ logger = logging.getLogger(__name__) ...@@ -15,7 +15,14 @@ logger = logging.getLogger(__name__)
def worker_list(request, worker_type=WORKER_STAFF): def worker_list(request, worker_type=WORKER_STAFF):
doctors_list = Worker.objects.order_by('-last_name') role_choices = role_choices_by_worker_type(worker_type)
roles = []
for role_type, role_name in role_choices:
roles.append(role_type)
doctors_list = Worker.objects.filter(roles__study_id=GLOBAL_STUDY_ID, roles__role__in=roles).order_by(
'-last_name')
context = { context = {
'doctors_list': doctors_list, 'doctors_list': doctors_list,
'worker_type': worker_type 'worker_type': worker_type
...@@ -25,7 +32,6 @@ def worker_list(request, worker_type=WORKER_STAFF): ...@@ -25,7 +32,6 @@ def worker_list(request, worker_type=WORKER_STAFF):
def role_choices_by_worker_type(worker_type): def role_choices_by_worker_type(worker_type):
logger.debug(worker_type)
if worker_type == WORKER_STAFF: if worker_type == WORKER_STAFF:
return STUDY_ROLE_CHOICES return STUDY_ROLE_CHOICES
elif worker_type == WORKER_HEALTH_PARTNER: elif worker_type == WORKER_HEALTH_PARTNER:
......
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