Skip to content

Commit b4d1d99

Browse files
committed
Sort parent options by label rather than name
We won't always have the name for a parent so we should be sorting on the label instead which handles the case when the name isn't there.
1 parent 6f0fb34 commit b4d1d99

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

app/controllers/draft_consents_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def set_parent_options
160160
(@patient.parents + @patient_session.consents.filter_map(&:parent))
161161
.compact
162162
.uniq
163-
.sort_by(&:full_name)
163+
.sort_by(&:label)
164164
end
165165

166166
# Returns:

spec/features/verbal_consent_given_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ def given_i_am_signed_in
2121
@session = create(:session, organisation:, programme:)
2222
@patient = create(:patient, session: @session)
2323

24+
create(
25+
:parent_relationship,
26+
patient: @patient,
27+
parent: build(:parent, full_name: nil)
28+
)
29+
2430
sign_in organisation.users.first
2531
end
2632

0 commit comments

Comments
 (0)