Skip to content

Commit

Permalink
Branch on fixed_term_full_year
Browse files Browse the repository at this point in the history
If the claimant has a fixed term contract we need to check the
fixed_term_full_year flag to determine whether or not to show the
variable hours provider questions
  • Loading branch information
rjlynch committed Sep 6, 2024
1 parent f1f601e commit 1fa6820
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 4 deletions.
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
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,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 @@ -385,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 @@ -403,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 @@ -508,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 @@ -571,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

0 comments on commit 1fa6820

Please sign in to comment.