Skip to content

Commit

Permalink
Merge pull request #3163 from DFE-Digital/update-provider-confrimatio…
Browse files Browse the repository at this point in the history
…n-form-copy

Show type of contract claimant selected
  • Loading branch information
rjlynch authored Sep 6, 2024
2 parents c9e1975 + 5a2a5e0 commit b1571e5
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,26 @@ def course_descriptions
@course_descriptions ||= claim.eligibility.courses_taught.map(&:description)
end

def claimant_contract_of_employment
claimant_option_selected(
"contract_type",
claim.eligibility.contract_type
).downcase
end

def teaching_hours_per_week
I18n.t(
[
"further_education_payments",
"forms",
"teaching_hours_per_week",
"options",
claim.eligibility.teaching_hours_per_week
].join(".")
claimant_option_selected(
"teaching_hours_per_week",
claim.eligibility.teaching_hours_per_week
).downcase
end

def claimant_contract_duration
if claim.eligibility.fixed_term_full_year
"covering the full academic year "
end
end

def assertions
@assertions ||= ASSERTIONS.fetch(contract_type).map do |assertion_name|
AssertionForm.new(name: assertion_name, parent_form: self)
Expand Down Expand Up @@ -132,6 +140,18 @@ def permitted_attributes
super + [assertions_attributes: AssertionForm.attribute_names]
end

def claimant_option_selected(question, option)
I18n.t(
[
"further_education_payments",
"forms",
question,
"options",
option
].join(".")
)
end

# Make sure the errors in the summary link to the correct nested field
def all_assertions_answered
assertions.each(&:validate).each_with_index do |assertion, i|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ def courses
end

def fixed_contract?
contract_type != "variable_hours"
case contract_type
when "permanent"
true
when "variable_hours"
false
when "fixed_term"
!!fixed_term_full_year
end
end

def verified?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
[:assertions, f.object.contract_type, ff.object.name, :label],
claimant: f.object.claimant_name,
provider: f.object.claim.school.name,
hours: f.object.teaching_hours_per_week
hours: f.object.teaching_hours_per_week,
type_of_contract: f.object.claimant_contract_of_employment,
duration: f.object.claimant_contract_duration
),
},
hint: -> do
Expand Down
6 changes: 3 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ en:
further_education_payments_provider:
journey_name: Claim a targeted retention incentive payment for further education teachers - provider
feedback_email: "[email protected]"
support_email_address: "FE-Levellingup.PremiumPayments@education.gov.uk"
support_email_address: "FE-targeted.retention-incentive@education.gov.uk"
forms:
verify_claim:
title: "Review a targeted retention incentive payment claim"
Expand All @@ -1185,7 +1185,7 @@ en:
assertions:
fixed_contract:
contract_type:
label: "Does %{claimant} have a permanent contract of employment at %{provider}?"
label: "Does %{claimant} have a %{type_of_contract} of employment %{duration}at %{provider}?"
errors:
inclusion: "Select yes if %{claimant} has a fixed term contract of employment at %{provider}"
teaching_responsibilities:
Expand All @@ -1210,7 +1210,7 @@ en:
inclusion: "Select yes if %{claimant} teaches this course for at least half their timetabled teaching hours"
variable_contract:
contract_type:
label: "Does %{claimant} have a variable hour contract of employment at %{provider}?"
label: "Does %{claimant} have a %{type_of_contract} of employment at %{provider}?"
errors:
inclusion: "Select yes if %{claimant} has a variable hours contract of employment at %{provider}"
teaching_responsibilities:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@
:further_education_payments_eligibility,
claim: claim_1,
school: fe_provider,
teaching_hours_per_week: "more_than_12"
teaching_hours_per_week: "more_than_12",
contract_type: "fixed_term"
)

claim_2 = create(
Expand All @@ -288,7 +289,8 @@
:further_education_payments_eligibility,
claim: claim_2,
school: fe_provider,
teaching_hours_per_week: "more_than_12"
teaching_hours_per_week: "more_than_12",
contract_type: "fixed_term"
)

mock_dfe_sign_in_auth_session(
Expand Down Expand Up @@ -383,7 +385,7 @@
expect(page).to have_text "This claim has already been verified"
end

scenario "provider approves a fixed contract claim" do
scenario "provider approves a long term fixed contract claim" do
fe_provider = create(:school, :further_education, name: "Springfield A and M")

claim = create(
Expand All @@ -401,6 +403,7 @@
school: fe_provider,
teaching_hours_per_week: "more_than_12",
contract_type: "fixed_term",
fixed_term_full_year: true,
subjects_taught: ["engineering_manufacturing"],
engineering_manufacturing_courses: [
"approved_level_321_transportation",
Expand Down Expand Up @@ -446,8 +449,8 @@
expect(page).to have_text "Claim date1 August 2024"

within_fieldset(
"Does Edna Krabappel have a permanent contract of employment at " \
"Springfield A and M?"
"Does Edna Krabappel have a fixed-term contract of employment covering " \
"the full academic year at Springfield A and M?"
) do
choose "Yes"
end
Expand Down Expand Up @@ -506,6 +509,147 @@
expect(page).to have_text "Claim reference number AB123456"
end

scenario "provider approves a short term fixed contract claim" do
fe_provider = create(:school, :further_education, name: "Springfield A and M")

claim = create(
:claim,
first_name: "Edna",
surname: "Krabappel",
date_of_birth: Date.new(1945, 7, 3),
reference: "AB123456",
created_at: DateTime.new(2024, 8, 1, 9, 0, 0)
)

create(
:further_education_payments_eligibility,
claim: claim,
school: fe_provider,
teaching_hours_per_week: "between_2_5_and_12",
contract_type: "fixed_term",
fixed_term_full_year: false,
subjects_taught: ["engineering_manufacturing"],
engineering_manufacturing_courses: [
"approved_level_321_transportation",
"level2_3_apprenticeship"
]
)

mock_dfe_sign_in_auth_session(
provider: :dfe_fe_provider,
auth_hash: {
uid: "11111",
extra: {
raw_info: {
organisation: {
id: "22222",
ukprn: fe_provider.ukprn
}
}
}
}
)

stub_dfe_sign_in_user_info_request(
"11111",
"22222",
Journeys::FurtherEducationPayments::Provider::CLAIM_VERIFIER_DFE_SIGN_IN_ROLE_CODE
)

claim_link = Journeys::FurtherEducationPayments::Provider::SlugSequence.verify_claim_url(claim)

visit claim_link

click_on "Start now"

expect(page).to have_text "Review a targeted retention incentive payment claim"
# The text generated by the dl tag doesn not include a space between the
# label and value (displays as expected in browser).
expect(page).to have_text "Claim referenceAB123456"
expect(page).to have_text "Claimant nameEdna Krabappel"
expect(page).to have_text "Claimant date of birth3 July 1945"
# FIXME RL enable this test once we've added the TRN to the eligibility
# expect(page).to have_text "Claimant teacher reference number (TRN)1234567"
expect(page).to have_text "Claim date1 August 2024"

within_fieldset(
"Does Edna Krabappel have a fixed-term contract of employment at " \
"Springfield A and M?"
) do
choose "Yes"
end

within_fieldset(
"Is Edna Krabappel a member of staff with teaching responsibilities?"
) do
choose "Yes"
end

within_fieldset(
"Is Edna Krabappel in the first 5 years of their further education " \
"teaching career in England?"
) do
choose "Yes"
end

within_fieldset(
"Has Edna Krabappel taught for at least one academic term at " \
"Springfield A and M?"
) do
choose "Yes"
end

within_fieldset(
"Is Edna Krabappel timetabled to teach an average of between 2.5 and " \
"12 hours per week during the current term?"
) do
choose "Yes"
end

within_fieldset(
"For at least half of their timetabled teaching hours, does " \
"Edna Krabappel teach 16- to 19-year-olds, including those up to " \
"age 25 with an Education, Health and Care Plan (EHCP)?"
) do
choose "Yes"
end

expect(page).to have_text(
"Qualifications approved for funding at level 3 and below in the " \
"transportation operations and maintenance (opens in new tab) sector " \
"subject area"
)

expect(page).to have_text(
"Level 2 or level 3 apprenticeships in the engineering and " \
"manufacturing occupational route (opens in new tab)"
)

within_fieldset(
"For at least half of their timetabled teaching hours, does " \
"Edna Krabappel teach:"
) do
choose "Yes"
end

within_fieldset(
"Will Edna Krabappel be timetabled to teach at least 2.5 hours per " \
"week next term?"
) do
choose "Yes"
end

check(
"To the best of my knowledge, I confirm that the information " \
"provided in this form is correct."
)

click_on "Submit"

expect(page).to have_content "Verification complete"
expect(page).to have_text "Claim reference number AB123456"
end

scenario "provider approves a variable contract claim" do
fe_provider = create(:school, :further_education, name: "Springfield A and M")

Expand Down Expand Up @@ -569,7 +713,7 @@
expect(page).to have_text "Claim date1 August 2024"

within_fieldset(
"Does Edna Krabappel have a variable hour contract of employment at " \
"Does Edna Krabappel have a variable hours contract of employment at " \
"Springfield A and M?"
) do
choose "Yes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
:further_education_payments_eligibility,
school: school,
teaching_hours_per_week: teaching_hours_per_week,
contract_type: contract_type
contract_type: contract_type,
fixed_term_full_year: true
)
end

Expand Down

0 comments on commit b1571e5

Please sign in to comment.