Skip to content

Commit 64f121a

Browse files
authored
Merge pull request #6435 from NHSDigital/reset-school-move-attributes
Ensure all school move attributes are reset
2 parents bf912c5 + 63041e5 commit 64f121a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

app/models/patient_changeset.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,12 @@ def school_move
290290
school_move =
291291
patient.school_moves.includes(:school_teams).first ||
292292
SchoolMove.new(patient:)
293+
294+
# TODO: Simplify this once we no longer have changesets with
295+
# `school_id` set to `nil`.
293296
school_move.assign_attributes(
294-
# TODO: Simplify this once we no longer have changesets with
295-
# `school_id` set to `nil`.
297+
academic_year:,
298+
home_educated: nil,
296299
school:
297300
school ||
298301
(
@@ -302,9 +305,10 @@ def school_move
302305
team.unknown_school
303306
end
304307
),
305-
academic_year:,
308+
team_id: nil,
306309
source: school_move_source
307310
)
311+
308312
# TODO: Figure out why this is necessary.
309313
school_move.strict_loading!(false)
310314
school_move

0 commit comments

Comments
 (0)