Skip to content

Commit

Permalink
Eager load location#suppliers to improve performance (#2402)
Browse files Browse the repository at this point in the history
- When a supplier_id was not provided, there was no eager loading.
  • Loading branch information
tobyprivett authored Nov 13, 2024
1 parent 3babb9c commit 8012671
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/services/locations/finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def apply_nomis_agency_filters(scope)
end

def apply_supplier_filters(scope)
scope = scope.includes(:suppliers)

return scope unless filter_params.key?(:supplier_id)

scope = scope.includes(:suppliers).where(suppliers: { id: split_params(:supplier_id) })
Expand Down

0 comments on commit 8012671

Please sign in to comment.