Skip to content

Commit

Permalink
update DiffusionHistory:by_status scope to eager load diffusion_histo…
Browse files Browse the repository at this point in the history
…ry_statuses
  • Loading branch information
PhilipDeFraties committed Jan 15, 2025
1 parent 39f2d7b commit 4e5ed6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/diffusion_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DiffusionHistory < ApplicationRecord

attr_accessor :facility_name

scope :by_status, -> (status) { joins(:diffusion_history_statuses).where(diffusion_history_statuses: {status: status}) }
scope :by_status, ->(status) { includes(:diffusion_history_statuses).where(diffusion_history_statuses: { status: status }) }
scope :get_by_successful_status, -> { (by_status('Completed')).or(by_status('Implemented')).or(by_status('Complete')) }
scope :get_by_in_progress_status, -> { (by_status('In progress')).or(by_status('Planning')).or(by_status('Implementing')) }
scope :get_by_unsuccessful_status, -> { by_status('Unsuccessful') }
Expand Down

0 comments on commit 4e5ed6c

Please sign in to comment.