diff --git a/app/controllers/case_contacts_controller.rb b/app/controllers/case_contacts_controller.rb index be54dca135..de49314d68 100644 --- a/app/controllers/case_contacts_controller.rb +++ b/app/controllers/case_contacts_controller.rb @@ -39,7 +39,7 @@ def new draft_case_ids = build_draft_case_ids(params, casa_cases) @case_contact = CaseContact.create_with_answers(current_organization, - creator: current_user, draft_case_ids: draft_case_ids) + creator: current_user, draft_case_ids: draft_case_ids, contact_made: true) if @case_contact.errors.any? flash[:alert] = @case_contact.errors.full_messages.join("\n") diff --git a/app/helpers/case_contacts_helper.rb b/app/helpers/case_contacts_helper.rb index 0f799b0156..54c37717a6 100644 --- a/app/helpers/case_contacts_helper.rb +++ b/app/helpers/case_contacts_helper.rb @@ -8,10 +8,6 @@ def duration_minutes(case_contact) case_contact.duration_minutes.to_i.remainder(60) end - def set_contact_made_false(case_contact) - case_contact.persisted? && case_contact.contact_made == false - end - def contact_mediums CaseContact::CONTACT_MEDIUMS.map { |contact_medium| OpenStruct.new(value: contact_medium, label: contact_medium.titleize) diff --git a/app/views/case_contacts/form/details.html.erb b/app/views/case_contacts/form/details.html.erb index 9ed6b817cc..a0176df41e 100644 --- a/app/views/case_contacts/form/details.html.erb +++ b/app/views/case_contacts/form/details.html.erb @@ -24,7 +24,6 @@
<%= form.radio_button :contact_made, true, - checked: @case_contact.contact_made, required: true, class: ["form-check-input", "case-contacts-form-checkbox"] %> <%= form.label "Yes", class: "form-check-label", @@ -32,7 +31,6 @@
<%= form.radio_button :contact_made, false, - checked: set_contact_made_false(@case_contact), required: true, class: ["form-check-input", "case-contacts-form-checkbox"] %> <%= form.label "No", class: "form-check-label", diff --git a/spec/helpers/case_contacts_helper_spec.rb b/spec/helpers/case_contacts_helper_spec.rb index d3969a42ac..ce9ad74296 100644 --- a/spec/helpers/case_contacts_helper_spec.rb +++ b/spec/helpers/case_contacts_helper_spec.rb @@ -68,23 +68,6 @@ end end - describe "#set_contact_made_false" do - it "returns false if contact_made is true" do - case_contact = create(:case_contact, contact_made: true) - expect(helper.set_contact_made_false(case_contact)).to eq(false) - end - - it "returns true if contact_made is false" do - case_contact = create(:case_contact, contact_made: false) - expect(helper.set_contact_made_false(case_contact)).to eq(true) - end - - it "returns false if contact_made is nil" do - case_contact = build(:case_contact, contact_made: nil) - expect(helper.set_contact_made_false(case_contact)).to eq(false) - end - end - describe "#show_volunteer_reimbursement" do before(:each) do @casa_cases = [] diff --git a/spec/system/case_contacts/new_spec.rb b/spec/system/case_contacts/new_spec.rb index 75fc4ea7d4..9858dcf139 100644 --- a/spec/system/case_contacts/new_spec.rb +++ b/spec/system/case_contacts/new_spec.rb @@ -260,10 +260,11 @@ # default values for other attributes (not from the last contact) expect(next_case_contact.status).to eq "started" expect(next_case_contact.miles_driven).to be_zero - %i[casa_case_id duration_minutes occurred_at contact_made medium_type + %i[casa_case_id duration_minutes occurred_at medium_type want_driving_reimbursement notes].each do |attribute| expect(next_case_contact.send(attribute)).to be_blank end + expect(next_case_contact.contact_made).to be true end it "does not reset referring location" do