Skip to content

Commit

Permalink
Merge pull request #3085 from DFE-Digital/fe-trn-persist
Browse files Browse the repository at this point in the history
Persist TRN on eligibility for FE journey
  • Loading branch information
asmega authored Aug 12, 2024
2 parents 3755400 + 23d0e63 commit f6eed83
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ class ClaimSubmissionForm < ::ClaimSubmissionBaseForm
private

def main_eligibility
@main_eligibility ||= Policies::FurtherEducationPayments::Eligibility.new
@main_eligibility ||= Policies::FurtherEducationPayments::Eligibility.new(
teacher_reference_number: @journey_session.answers.teacher_reference_number
)
end

def calculate_award_amount(eligibility)
Expand Down
2 changes: 2 additions & 0 deletions config/analytics_blocklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,7 @@
- teacher_reference_number
:student_loans_eligibilities:
- teacher_reference_number
:further_education_payments_eligibilities:
- teacher_reference_number
:journeys_sessions:
- answers
5 changes: 5 additions & 0 deletions db/migrate/20240812123209_add_trn_to_fe_eligibilities.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddTrnToFeEligibilities < ActiveRecord::Migration[7.0]
def change
add_column :further_education_payments_eligibilities, :teacher_reference_number, :text
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_08_153424) do
ActiveRecord::Schema[7.0].define(version: 2024_08_12_123209) 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 @@ -217,6 +217,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.decimal "award_amount", precision: 7, scale: 2
t.text "teacher_reference_number"
end

create_table "international_relocation_payments_eligibilities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
Expand Down
15 changes: 14 additions & 1 deletion spec/features/further_education_payments/happy_path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,20 @@
click_on "Continue"

expect(page).to have_content("Check your answers before sending your application")
click_on "Accept and send"

expect do
click_on "Accept and send"
end.to change { Claim.count }.by(1)
.and change { Policies::FurtherEducationPayments::Eligibility.count }.by(1)

claim = Claim.last

expect(claim.first_name).to eql("John")
expect(claim.surname).to eql("Doe")

eligibility = Policies::FurtherEducationPayments::Eligibility.last

expect(eligibility.teacher_reference_number).to eql("1234567")

expect(page).to have_content("You applied for a further education retention payment")
end
Expand Down

0 comments on commit f6eed83

Please sign in to comment.