Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def call
- scope = base_relation.joins(:care_periods)
- if params.care_provider_id.present?
- scope = scope
- .where(care_periods: { care_provider_id: params.care_provider_id })
- end
- if params.hospital_id.present?
- scope = scope
- .where(care_periods: { hospital_id: params.hospital_id })
- end
- if params.discharge_period.present?
- scope = scope.joins(:hospital_visit)
- .where(hospital_visits: { end_on: params.discharge_period }
- end
- scope
- end
Add Comment
Please, Sign In to add comment