Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<% active = ->(a) { !a.inactive? && (a.end_date.nil? || a.end_date >= Date.current) } %>
<% position = submitted_position.to_s.strip %>
<% is_submitted_org = submitted_org_name.to_s.strip.present? && org.name.to_s.strip.casecmp?(submitted_org_name.to_s.strip) %>
<% role_affiliations = affiliations.reject(&:facilitator?) %>
<div class="flex flex-wrap items-center gap-1.5 mt-1.5">
<span class="text-[0.65rem] font-semibold uppercase tracking-wide text-gray-400">Affiliations:</span>
<% affiliations.each do |a| %>
Expand All @@ -28,7 +27,7 @@
<% title_attr = a.facilitator? ? "Facilitator role β€” determines whether the org is active with AWBW" : nil %>
<span class="<%= badge %> <%= color %>" title="<%= title_attr %>"><%= label %></span>
<% end %>
<% if is_submitted_org && position.present? && role_affiliations.none? { |a| a.title.to_s.casecmp?(position) } %>
<% if is_submitted_org && position.present? && affiliations.none? { |a| a.title.to_s.casecmp?(position) } %>
<span class="<%= badge %> bg-amber-50 text-amber-700 border-amber-200" title="Form: <%= position %>">Title differs from form (form: <%= position %>)</span>
<% end %>
</div>
Expand Down
9 changes: 9 additions & 0 deletions spec/requests/event_registrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,15 @@ def details_open?(body, heading)
expect(response.body).not_to include("Title differs from form")
end

it "does not show a title-comparison badge when a facilitator affiliation matches the submitted 'Facilitator' position" do
create(:affiliation, person: regular_user.person, organization: organization, title: "Facilitator")
submit_form(org_name: organization.name, position: "Facilitator")

get link_organization_event_registration_path(existing_registration)

expect(response.body).not_to include("Title differs from form")
end

it "shows 'Title differs from form' when the affiliation title differs from the submitted position" do
create(:affiliation, person: regular_user.person, organization: organization, title: "Counselor")
submit_form(org_name: organization.name, position: "Director")
Expand Down