Skip to content

Commit

Permalink
use pluck, admin edit test tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
thejonroberts committed Oct 20, 2024
1 parent eb35c9c commit 027f3a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/case_contacts/form_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def prepare_form
@grouped_contact_types = group_contact_types_by_name(contact_types)
@contact_topics = get_contact_topics

if @case_contact.contact_topic_answers.empty? && !@case_contact.active?
if !@case_contact.active? && @case_contact.contact_topic_answers.empty?
if @contact_topics.present?
@case_contact.contact_topic_answers.create
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/case_contacts/form/details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
Contact Type(s)<span class="red-letter">*</span>
</h3>
<div id="contact-form-types" class="mb-3">
<% casa_case_ids = @casa_cases.collect(&:id) %>
<% casa_case_ids = @casa_cases.pluck(:id) %>
<% @grouped_contact_types.each do |group_name, contact_types| %>
<fieldset class="form-group">
<legend><%= group_name %></legend>
Expand Down
2 changes: 1 addition & 1 deletion spec/system/case_contacts/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

context "when admin" do
let(:admin) { create(:casa_admin, casa_org: organization) }
let(:case_contact) { create(:case_contact, duration_minutes: 105, casa_case:, creator: admin) }

let(:user) { admin }

Expand Down Expand Up @@ -56,6 +55,7 @@

it "does not allow volunteer address edit for case contact with ambiguous volunteer" do
create(:case_assignment, casa_case:, volunteer: create(:volunteer, casa_org: organization))
case_contact.update!(creator: admin)
expect(casa_case.volunteers).not_to include case_contact.creator
expect(casa_case.volunteers.size).to be > 1

Expand Down

0 comments on commit 027f3a6

Please sign in to comment.