Skip to content

Commit

Permalink
fix: improved query
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticspoon committed Apr 8, 2024
1 parent 52fc2e6 commit 985f1a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/case_court_report_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def case_orders(orders)
end

def filtered_interviewees
# this query is slow
CaseContactContactType.includes(:case_contact, :contact_type)
CaseContactContactType
.joins(:contact_type, case_contact: :casa_case)
.where("case_contacts.casa_case_id": @casa_case.id)
.where("case_contacts.occurred_at": @date_range)
end
Expand Down

0 comments on commit 985f1a3

Please sign in to comment.