Guest User

Untitled

a guest
Apr 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. def call
  2. scope = base_relation.joins(:care_periods)
  3.  
  4. if params.care_provider_id.present?
  5. scope = scope
  6. .where(care_periods: { care_provider_id: params.care_provider_id })
  7. end
  8.  
  9. if params.hospital_id.present?
  10. scope = scope
  11. .where(care_periods: { hospital_id: params.hospital_id })
  12. end
  13.  
  14. if params.discharge_period.present?
  15. scope = scope.joins(:hospital_visit)
  16. .where(hospital_visits: { end_on: params.discharge_period }
  17. end
  18.  
  19. scope
  20. end
Add Comment
Please, Sign In to add comment