Skip to content

Commit

Permalink
Capture practitioner names
Browse files Browse the repository at this point in the history
When the provider enters the practitioner name it's stored in the
`Claim#first_name` and `Claim#surname` fields. When the practitioner
completes their portion of the journey the details they entered on the
personal details step overwrites the values entered by the provider in
the `Claim#first_name` and `Claim#surname` fields.
We have a requirement to show and compare both the provider
entered claimant name and practitioner entered claimant name in the
admin area, this commit stores the provider entered name information in
two new fields allowing us to do this.
  • Loading branch information
rjlynch committed Oct 31, 2024
1 parent 33e9dc7 commit 985e620
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ class ClaimantNameForm < Form
def save
return false if invalid?

journey_session.answers.assign_attributes(first_name:, surname:)
journey_session.answers.assign_attributes(
first_name: first_name,
surname: surname,
practitioner_first_name: first_name,
practitioner_surname: surname
)
journey_session.save!
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class SessionAnswers < Journeys::SessionAnswers
attribute :practitioner_email_address
attribute :provider_contact_name
attribute :provider_email_address
attribute :practitioner_first_name
attribute :practitioner_surname

def policy
Policies::EarlyYearsPayments
Expand Down
2 changes: 2 additions & 0 deletions config/analytics_blocklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@
- answers
:early_years_payment_eligibilities:
- provider_email_address
- practitioner_first_name
- practitioner_surname
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddClaimantDetailsToEyEligibilities < ActiveRecord::Migration[7.0]
def change
add_column :early_years_payment_eligibilities, :practitioner_first_name, :string
add_column :early_years_payment_eligibilities, :practitioner_surname, :string
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_10_28_161228) do
ActiveRecord::Schema[7.0].define(version: 2024_10_30_153139) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_trgm"
Expand Down Expand Up @@ -204,6 +204,8 @@
t.boolean "returner_worked_with_children"
t.string "returner_contract_type"
t.decimal "award_amount", precision: 7, scale: 2
t.string "practitioner_first_name"
t.string "practitioner_surname"
end

create_table "eligible_ey_providers", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
paye_reference { "123/A" }
first_name { "John" }
surname { "Doe" }
practitioner_first_name { "John" }
practitioner_surname { "Doe" }
start_date { Date.parse("1/1/2024") }
child_facing_confirmation_given { true }
returning_within_6_months { true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
expect(eligibility.start_date).to eq answers.start_date
expect(eligibility.provider_claim_submitted_at).to be_present
expect(eligibility.provider_email_address).to eq "[email protected]"
expect(eligibility.practitioner_first_name).to eq answers.first_name
expect(eligibility.practitioner_surname).to eq answers.surname
end

it "sends a notify email to the practitioner" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
expect { subject.save }.to(
change { journey_session.answers.first_name }.to(first_name).and(
change { journey_session.answers.surname }.to(surname)
).and(
change { journey_session.answers.practitioner_first_name }.to(first_name)
).and(
change { journey_session.answers.practitioner_surname }.to(surname)
)
)
end
Expand Down

0 comments on commit 985e620

Please sign in to comment.