diff --git a/portal/views/patients.py b/portal/views/patients.py index 5d07c72b2..6d74efb83 100644 --- a/portal/views/patients.py +++ b/portal/views/patients.py @@ -182,11 +182,17 @@ def requested_orgs(user, research_study_id): distinct_action = PatientList.query.distinct(PatientList.action_state).with_entities( PatientList.action_state) options.append({"action_state": [(state[0], _(state[0])) for state in distinct_action]}) + distinct_visits = PatientList.query.distinct(PatientList.empro_visit).with_entities( + PatientList.empro_visit) + options.append({"empro_visit": [(visit[0], _(visit[0])) for visit in distinct_visits]}) else: distinct_status = PatientList.query.distinct( PatientList.questionnaire_status).with_entities(PatientList.questionnaire_status) options.append( {"questionnaire_status": [(status[0], _(status[0])) for status in distinct_status]}) + distinct_visits = PatientList.query.distinct(PatientList.visit).with_entities( + PatientList.visit) + options.append({"visit": [(visit[0], _(visit[0])) for visit in distinct_visits]}) viewable_orgs = requested_orgs(user, research_study_id) query = PatientList.query.filter(PatientList.org_id.in_(viewable_orgs))