Skip to content

Commit

Permalink
Capture whether the claim was flagged as a dup
Browse files Browse the repository at this point in the history
In a future piece of work we're going to want to show the status of
duplicate claims in the admin task area, in order to support that we
need a mechanism to differentiate between claims that weren't sent to
the provider to verify and claims that are awaiting provider
verification.
  • Loading branch information
rjlynch committed Sep 4, 2024
1 parent 36c5bdd commit 51f323d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ class ClaimSubmissionForm < ::ClaimSubmissionBaseForm
def save
super

unless Policies::FurtherEducationPayments.duplicate_claim?(claim)
if Policies::FurtherEducationPayments.duplicate_claim?(claim)
claim.eligibility.update!(flagged_as_duplicate: true)
else
ClaimMailer.further_education_payment_provider_verification_email(claim).deliver_later
end

Expand Down
1 change: 1 addition & 0 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ shared:
- subject_to_formal_performance_action
- subject_to_disciplinary_action
- half_teaching_hours
- flagged_as_duplicate
:eligible_fe_providers:
- id
- ukprn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AddFlaggedAsDuplicateToFurtherEducationPaymentsEligibilities < ActiveRecord::Migration[7.0]
def change
add_column :further_education_payments_eligibilities,
:flagged_as_duplicate,
:boolean,
default: false
end
end
3 changes: 2 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_08_21_121253) do
ActiveRecord::Schema[7.0].define(version: 2024_09_04_105917) 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 @@ -254,6 +254,7 @@
t.boolean "subject_to_disciplinary_action"
t.boolean "half_teaching_hours"
t.jsonb "verification", default: {}
t.boolean "flagged_as_duplicate", default: false
t.index ["possible_school_id"], name: "index_fe_payments_eligibilities_on_possible_school_id"
t.index ["school_id"], name: "index_fe_payments_eligibilities_on_school_id"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
expect(eligibility.subject_to_formal_performance_action).to eq(answers.subject_to_formal_performance_action)
expect(eligibility.subject_to_disciplinary_action).to eq(answers.subject_to_disciplinary_action)
expect(eligibility.half_teaching_hours).to eq(answers.half_teaching_hours)
expect(eligibility.flagged_as_duplicate).to eq(false)
end

it "emails the claim provider" do
Expand Down Expand Up @@ -91,12 +92,19 @@
receive(:further_education_payment_provider_verification_email)
).and_return(double(deliver_later: nil))

2.times { described_class.new(journey_session: journey_session).save }
first_claim_form = described_class.new(journey_session: journey_session)
second_claim_form = described_class.new(journey_session: journey_session)

first_claim_form.save
second_claim_form.save

expect(ClaimMailer).to(
have_received(:further_education_payment_provider_verification_email)
.exactly(1).times
)

duplicate_claim = second_claim_form.claim
expect(duplicate_claim.eligibility.flagged_as_duplicate).to eq(true)
end
end
end

0 comments on commit 51f323d

Please sign in to comment.