Skip to content

Commit 7daefb1

Browse files
maebealeclaude
andauthored
Show "Other" service-area answers as additional sectors (#1700)
A respondent's free-text Other service area isn't a concrete sector, so it belongs alongside the additional sectors rather than under the single primary sector. Seed data follows suit: the catch-all Other sector is the free-text fallback, not a selectable service area, so exclude it from the seeded tags. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent afb9d34 commit 7daefb1

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

app/views/people/show.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,30 +132,30 @@
132132
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
133133
<div>
134134
<h2 class="text-lg font-semibold text-gray-800 mb-3">Primary sector</h2>
135-
<% if primary_sector_items.any? || other_service_areas.any? %>
135+
<% if primary_sector_items.any? %>
136136
<div class="flex flex-wrap gap-2">
137137
<% primary_sector_items.each do |si| %>
138138
<%= render "sectors/tagging_label",
139139
sector: si.sector,
140140
display_leader: true,
141141
is_leader: si.is_leader %>
142142
<% end %>
143-
<%= render "people/other_responses", responses: other_service_areas %>
144143
</div>
145144
<% else %>
146145
<p class="text-gray-500 italic">None selected.</p>
147146
<% end %>
148147
</div>
149148
<div>
150149
<h2 class="text-lg font-semibold text-gray-800 mb-3">Additional sectors</h2>
151-
<% if additional_sector_items.any? %>
150+
<% if additional_sector_items.any? || other_service_areas.any? %>
152151
<div class="flex flex-wrap gap-2">
153152
<% additional_sector_items.each do |si| %>
154153
<%= render "sectors/tagging_label",
155154
sector: si.sector,
156155
display_leader: true,
157156
is_leader: si.is_leader %>
158157
<% end %>
158+
<%= render "people/other_responses", responses: other_service_areas %>
159159
</div>
160160
<% else %>
161161
<p class="text-gray-500 italic">None selected.</p>

db/seeds/dev/events_management.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,10 @@
648648
# answered on a submission, and only enriches people who have a submission (so the
649649
# "registered but didn't fill the form" scenarios stay answer-free).
650650
age_range_categories = Category.age_ranges.published.order(:position, :name).to_a
651-
service_area_sectors = Sector.published.order(:name).to_a
651+
# Exclude the catch-all "Other" sector: it's the free-text fallback registrants
652+
# type into (surfaced via Person#other_service_area_responses), not a selectable
653+
# service area. Seeding it as a sector tag would list "Other" as a real service area.
654+
service_area_sectors = Sector.published.excluding_other.order(:name).to_a
652655

653656
record_professional_answers = ->(submission, i) do
654657
person = submission.person

spec/requests/people_other_responses_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ def answer(identifier, value)
1414
before { sign_in admin }
1515

1616
describe "profile page" do
17-
it "shows the Other service area beside the sector tags" do
17+
it "shows the Other service area as an additional sector" do
1818
person.update!(profile_show_sectors: true)
1919
answer("primary_service_area", "Other: Equine therapy")
2020

2121
get person_path(person)
2222

2323
expect(response.body).to include("Equine therapy")
24+
# The Other chip sits in the "Additional sectors" column, not "Primary sector".
25+
additional_section = response.body.split("Additional sectors").last
26+
expect(additional_section).to include("Equine therapy")
2427
end
2528
end
2629

0 commit comments

Comments
 (0)