Skip to content

Commit 250fbc1

Browse files
committed
Remove duplication in SchoolMove
This removes duplicate calls to `PatientTeamUpdater` and `PatientStatusUpdater` in the `SchoolMove#confirm!` method. Previously we were calling these in both the `update_locations!`, and `update_patient_statuses!` and `update_patient_teams!` methods. I expect that removing the duplication should introduce a small performance improvement on school moves.
1 parent fa4587e commit 250fbc1

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

app/models/school_move.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def assign_from(school:, home_educated:, team:)
7979

8080
def confirm!(user: nil)
8181
ActiveRecord::Base.transaction do
82-
# We need to set this before updating patient locations
8382
move_across_teams = from_another_team?
8483

8584
update_patient!
@@ -90,6 +89,7 @@ def confirm!(user: nil)
9089

9190
update_patient_teams!
9291
update_patient_statuses!
92+
9393
if move_across_teams
9494
create_important_notice!(log_entry)
9595
update_important_notices!
@@ -191,9 +191,6 @@ def update_locations!
191191
columns: %i[date_range]
192192
}
193193
)
194-
195-
PatientTeamUpdater.call(patient:)
196-
PatientStatusUpdater.call(patient:)
197194
end
198195

199196
def create_log_entry!(user:)

0 commit comments

Comments
 (0)