From 00c0d9af05170df73742e0a9882f906945c5ba5e Mon Sep 17 00:00:00 2001 From: Giuseppe Lobraico Date: Wed, 26 Jun 2024 17:20:04 +0100 Subject: [PATCH] CAPT-1419 ECP exit screen showing incorrect text for AY24-25 (when induction not completed) (#2766) * Move last policy year value to `Policies::EarlyCareerPayments` For consistency with the Student Loans policy * Move last policy year value to `Policies::LevellingUpPremiumPayments` For consistency with the Student Loans policy Add the first policy year value as well. * Remove redundant methods from `Policies::EarlyCareerPayments` These were created a while ago for consistency with Student Loans, but the meaning here is completely different and misleading. The QTS Award year is not linked to the policy start/end year. * Use `#any_future_policy_years?` to evaluate against the the policy specific end year * Fix eligibility criteria url for ECP * Make sure an ECP claim is ineligible when induction not completed and it's the end year for ECP For years previous to the final one, if a user selected an ECP-only school (meaning the LUPP claim is ineligible), and answered "No" to the induction question, they'd be able to see the eligible-later slug and set up a reminder. * Fix copy * Use session answers instead of claim object * Fix bug in ineligible page * Remove shim class workaround --------- Co-authored-by: Steve Lorek --- app/models/concerns/eligibility_checkable.rb | 10 ++++++++- .../early_career_payments/eligible.rb | 4 ++-- .../slug_sequence.rb | 5 +++-- app/models/policies/early_career_payments.rb | 9 +------- .../early_career_payments/eligibility.rb | 3 +-- .../policies/levelling_up_premium_payments.rb | 5 ++++- .../eligibility.rb | 3 +-- ..._ecp_only_induction_not_completed.html.erb | 17 +++++++++++++++ ...ility_trainee_in_last_policy_year.html.erb | 2 +- lib/ineligibility_reason_checker.rb | 13 ++++++++++-- .../session_answers.rb | 6 ++++++ ...gible_early_career_payments_claims_spec.rb | 21 +++++++++++++++++++ spec/models/early_career_payments_spec.rb | 6 ------ .../levelling_up_premium_payments_spec.rb | 2 +- .../policy_eligibility_checker_spec.rb | 14 ++++++++----- 15 files changed, 87 insertions(+), 33 deletions(-) create mode 100644 app/views/additional_payments/claims/_ineligibility_ecp_only_induction_not_completed.html.erb diff --git a/app/models/concerns/eligibility_checkable.rb b/app/models/concerns/eligibility_checkable.rb index 4d77e87140..77cd0f2dda 100644 --- a/app/models/concerns/eligibility_checkable.rb +++ b/app/models/concerns/eligibility_checkable.rb @@ -121,10 +121,18 @@ def sufficient_teaching? end def common_eligible_later_attributes? - any_future_policy_years? && indicated_eligible_school? + any_future_combined_policy_years? && indicated_eligible_school? + end + + def policy_end_year + policy::POLICY_END_YEAR end def any_future_policy_years? + claim_year < policy_end_year + end + + def any_future_combined_policy_years? claim_year < FINAL_COMBINED_ECP_AND_LUP_POLICY_YEAR end end diff --git a/app/models/concerns/policies/early_career_payments/eligible.rb b/app/models/concerns/policies/early_career_payments/eligible.rb index 6e76ff7152..6899541abb 100644 --- a/app/models/concerns/policies/early_career_payments/eligible.rb +++ b/app/models/concerns/policies/early_career_payments/eligible.rb @@ -42,7 +42,7 @@ def itt_subject_eligible_now? end def specific_ineligible_attributes? - trainee_teacher? || (induction_not_completed? && !ecp_only_school?) || itt_subject_ineligible_now_and_in_the_future? + trainee_teacher? || (induction_not_completed? && !any_future_policy_years?) || itt_subject_ineligible_now_and_in_the_future? end def itt_subject_ineligible_now_and_in_the_future? @@ -55,7 +55,7 @@ def itt_subject_ineligible_now_and_in_the_future? end def specific_eligible_later_attributes? - newly_qualified_teacher? && ((induction_not_completed? && ecp_only_school?) || (!itt_subject_eligible_now? && itt_subject_eligible_later?)) + newly_qualified_teacher? && ((induction_not_completed? && any_future_policy_years?) || (!itt_subject_eligible_now? && itt_subject_eligible_later?)) end def itt_subject_eligible_later? diff --git a/app/models/journeys/additional_payments_for_teaching/slug_sequence.rb b/app/models/journeys/additional_payments_for_teaching/slug_sequence.rb index 29cea1c0b8..2581ae2f17 100644 --- a/app/models/journeys/additional_payments_for_teaching/slug_sequence.rb +++ b/app/models/journeys/additional_payments_for_teaching/slug_sequence.rb @@ -184,12 +184,13 @@ def personal_details_form end def replace_ecp_only_induction_not_completed_slugs(sequence) + dead_end_slug = (ecp_eligibility_checker.status == :eligible_later) ? "eligible-later" : "ineligible" + slugs = %w[ current-school nqt-in-academic-year-after-itt induction-completed - eligible-later - ] + ] << dead_end_slug sequence.replace(slugs) end diff --git a/app/models/policies/early_career_payments.rb b/app/models/policies/early_career_payments.rb index 946a59b1c0..8d6bffbe94 100644 --- a/app/models/policies/early_career_payments.rb +++ b/app/models/policies/early_career_payments.rb @@ -23,6 +23,7 @@ module EarlyCareerPayments ].freeze POLICY_START_YEAR = AcademicYear.new(2021).freeze + POLICY_END_YEAR = AcademicYear.new(2024).freeze # Used in # - checking payments with multiple policies: ClaimsPreventingPaymentFinder @@ -48,14 +49,6 @@ def notify_reply_to_id "3f85a1f7-9400-4b48-9a31-eaa643d6b977" end - def first_eligible_qts_award_year(claim_year = nil) - POLICY_START_YEAR - end - - def last_ineligible_qts_award_year - first_eligible_qts_award_year - 1 - end - def student_loan_balance_url "https://www.gov.uk/sign-in-to-manage-your-student-loan-balance" end diff --git a/app/models/policies/early_career_payments/eligibility.rb b/app/models/policies/early_career_payments/eligibility.rb index b01583141e..d55458fdd8 100644 --- a/app/models/policies/early_career_payments/eligibility.rb +++ b/app/models/policies/early_career_payments/eligibility.rb @@ -16,7 +16,6 @@ def policy self.table_name = "early_career_payments_eligibilities" FIRST_ITT_AY = "2016/2017" - LAST_POLICY_YEAR = "2024/2025" # Generates an object similar to # { @@ -31,7 +30,7 @@ def policy # and the enums would be stale until after a server restart. # Make all valid ITT values based on the last known policy year. ITT_ACADEMIC_YEARS = - (AcademicYear.new(FIRST_ITT_AY)...AcademicYear.new(LAST_POLICY_YEAR)).each_with_object({}) do |year, hsh| + (AcademicYear.new(FIRST_ITT_AY)...POLICY_END_YEAR).each_with_object({}) do |year, hsh| hsh[year] = AcademicYear::Type.new.serialize(year) end.merge({AcademicYear.new => AcademicYear::Type.new.serialize(AcademicYear.new)}) diff --git a/app/models/policies/levelling_up_premium_payments.rb b/app/models/policies/levelling_up_premium_payments.rb index 57c9072399..052fa437bb 100644 --- a/app/models/policies/levelling_up_premium_payments.rb +++ b/app/models/policies/levelling_up_premium_payments.rb @@ -24,6 +24,9 @@ module LevellingUpPremiumPayments SEARCHABLE_ELIGIBILITY_ATTRIBUTES = %w[teacher_reference_number].freeze + POLICY_START_YEAR = AcademicYear.new(2022).freeze + POLICY_END_YEAR = AcademicYear.new(2024).freeze + def notify_reply_to_id "03ece7eb-2a5b-461b-9c91-6630d0051aa6" end @@ -33,7 +36,7 @@ def eligibility_page_url end def eligibility_criteria_url - eligibility_page_url + "#eligibility-criteria-for-teachers" + eligibility_page_url + "#eligibility-criteria" end def payment_and_deductions_info_url diff --git a/app/models/policies/levelling_up_premium_payments/eligibility.rb b/app/models/policies/levelling_up_premium_payments/eligibility.rb index 042b95ba67..4010fef8d1 100644 --- a/app/models/policies/levelling_up_premium_payments/eligibility.rb +++ b/app/models/policies/levelling_up_premium_payments/eligibility.rb @@ -24,7 +24,6 @@ def policy AMENDABLE_ATTRIBUTES = [:teacher_reference_number, :award_amount].freeze FIRST_ITT_AY = "2017/2018" - LAST_POLICY_YEAR = "2024/2025" # Generates an object similar to # { @@ -39,7 +38,7 @@ def policy # and the enums would be stale until after a server restart. # Make all valid ITT values based on the last known policy year. ITT_ACADEMIC_YEARS = - (AcademicYear.new(FIRST_ITT_AY)...AcademicYear.new(LAST_POLICY_YEAR)).each_with_object({}) do |year, hsh| + (AcademicYear.new(FIRST_ITT_AY)...POLICY_END_YEAR).each_with_object({}) do |year, hsh| hsh[year] = AcademicYear::Type.new.serialize(year) end.merge({AcademicYear.new => AcademicYear::Type.new.serialize(AcademicYear.new)}) diff --git a/app/views/additional_payments/claims/_ineligibility_ecp_only_induction_not_completed.html.erb b/app/views/additional_payments/claims/_ineligibility_ecp_only_induction_not_completed.html.erb new file mode 100644 index 0000000000..4496c285ff --- /dev/null +++ b/app/views/additional_payments/claims/_ineligibility_ecp_only_induction_not_completed.html.erb @@ -0,0 +1,17 @@ +

+ You are not eligible for the + <%= link_to("early-career payment (opens in new tab)", Policies::EarlyCareerPayments.eligibility_criteria_url, class: "govuk-link", target: "_blank") %> + because you have not completed your induction. +

+

+ You are not eligible for the + <%= link_to("levelling up premium payment (opens in new tab)", Policies::LevellingUpPremiumPayments.eligibility_criteria_url, class: "govuk-link", target: "_blank") %> + because the school you teach in is not eligible. Levelling up premium payments are offered in schools identified as having a higher need for teachers. +

+ +

+ For more information, check the eligibility criteria for + <%= link_to("early-career payments", Policies::EarlyCareerPayments.eligibility_criteria_url, class: "govuk-link") %> + and + <%= link_to("levelling up premium payments", Policies::LevellingUpPremiumPayments.eligibility_criteria_url, class: "govuk-link") %>. +

diff --git a/app/views/additional_payments/claims/_ineligibility_trainee_in_last_policy_year.html.erb b/app/views/additional_payments/claims/_ineligibility_trainee_in_last_policy_year.html.erb index 9a9c4aac8d..ae8a10e8e6 100644 --- a/app/views/additional_payments/claims/_ineligibility_trainee_in_last_policy_year.html.erb +++ b/app/views/additional_payments/claims/_ineligibility_trainee_in_last_policy_year.html.erb @@ -6,7 +6,7 @@ You will not be eligible for the <%= link_to("early-career payment", Policies::EarlyCareerPayments.eligibility_criteria_url, class: "govuk-link") %> or the - <%= link_to("levelling up premium payment", LevellingUpPremiumPayments.eligibility_criteria_url, class: "govuk-link") %> + <%= link_to("levelling up premium payment", Policies::LevellingUpPremiumPayments.eligibility_criteria_url, class: "govuk-link") %> once you start work as a qualified teacher.

diff --git a/lib/ineligibility_reason_checker.rb b/lib/ineligibility_reason_checker.rb index c9085659ea..8362bbf821 100644 --- a/lib/ineligibility_reason_checker.rb +++ b/lib/ineligibility_reason_checker.rb @@ -16,6 +16,8 @@ def reason :generic elsif trainee_teacher_last_policy_year? :trainee_in_last_policy_year + elsif ecp_only_induction_not_completed? + :ecp_only_induction_not_completed elsif ecp_only_trainee_teacher? :ecp_only_trainee_teacher elsif trainee_teaching_lacking_both_valid_itt_subject_and_degree? @@ -83,6 +85,13 @@ def generic? ].any? end + def ecp_only_induction_not_completed? + [ + school_eligible_for_ecp_but_not_lup?(@answers.current_school), + @answers.induction_not_completed? + ].all? + end + def ecp_only_trainee_teacher? [ !Policies::LevellingUpPremiumPayments::SchoolEligibility.new(@answers.current_school).eligible?, @@ -181,8 +190,8 @@ def no_ecp_subjects_that_itt_year? def trainee_teacher_last_policy_year? [ @answers.nqt_in_academic_year_after_itt == false, - @answers.academic_year >= AcademicYear.new(Policies::LevellingUpPremiumPayments::Eligibility::LAST_POLICY_YEAR), - @answers.academic_year >= AcademicYear.new(Policies::EarlyCareerPayments::Eligibility::LAST_POLICY_YEAR) + @answers.academic_year >= AcademicYear.new(Policies::LevellingUpPremiumPayments::POLICY_END_YEAR), + @answers.academic_year >= AcademicYear.new(Policies::EarlyCareerPayments::POLICY_END_YEAR) ].all? end end diff --git a/spec/factories/journeys/additional_payments_for_teaching/session_answers.rb b/spec/factories/journeys/additional_payments_for_teaching/session_answers.rb index 6847b81ba5..1c051a91e8 100644 --- a/spec/factories/journeys/additional_payments_for_teaching/session_answers.rb +++ b/spec/factories/journeys/additional_payments_for_teaching/session_answers.rb @@ -179,6 +179,12 @@ end end + trait :eligible_school_ecp_only do + current_school_id do + create(:school, :early_career_payments_eligible, :levelling_up_premium_payments_ineligible).id + end + end + trait :short_term_supply_teacher do employed_as_supply_teacher { true } has_entire_term_contract { false } diff --git a/spec/features/ineligible_early_career_payments_claims_spec.rb b/spec/features/ineligible_early_career_payments_claims_spec.rb index 0974155eee..67b558c0de 100644 --- a/spec/features/ineligible_early_career_payments_claims_spec.rb +++ b/spec/features/ineligible_early_career_payments_claims_spec.rb @@ -20,6 +20,27 @@ expect(page).to have_text("The school you have selected is not eligible") end + scenario "induction not completed and it's the last policy year" do + Journeys.for_policy(Policies::EarlyCareerPayments).configuration.update!(current_academic_year: Policies::EarlyCareerPayments::POLICY_END_YEAR) + + start_early_career_payments_claim + + skip_tid + + choose_school eligible_school + + # - Are you currently teaching as a qualified teacher? + choose "Yes" + click_on "Continue" + + # - Have you completed your induction as an early-career teacher? + choose "No" + click_on "Continue" + + expect(page).to have_text(I18n.t("additional_payments.ineligible.heading")) + expect(page).to have_css("div#ecp_only_induction_not_completed") + end + scenario "when poor performance - subject to formal performance action" do start_early_career_payments_claim diff --git a/spec/models/early_career_payments_spec.rb b/spec/models/early_career_payments_spec.rb index 1b30620d50..1c71e9cffd 100644 --- a/spec/models/early_career_payments_spec.rb +++ b/spec/models/early_career_payments_spec.rb @@ -26,12 +26,6 @@ ) } - describe ".first_eligible_qts_award_year" do - it "can return the AcademicYear based on a passed-in academic year" do - expect(described_class.first_eligible_qts_award_year(AcademicYear.new(2024))).to eq AcademicYear.new(2021) - end - end - describe ".payroll_file_name" do subject(:payroll_file_name) { described_class.payroll_file_name } it { is_expected.to eq("EarlyCareerPayments") } diff --git a/spec/models/levelling_up_premium_payments_spec.rb b/spec/models/levelling_up_premium_payments_spec.rb index 4c94cd8957..6e9171222b 100644 --- a/spec/models/levelling_up_premium_payments_spec.rb +++ b/spec/models/levelling_up_premium_payments_spec.rb @@ -19,7 +19,7 @@ locale_key: "levelling_up_premium_payments", notify_reply_to_id: "03ece7eb-2a5b-461b-9c91-6630d0051aa6", eligibility_page_url: "https://www.gov.uk/guidance/levelling-up-premium-payments-for-teachers", - eligibility_criteria_url: "https://www.gov.uk/guidance/levelling-up-premium-payments-for-teachers#eligibility-criteria-for-teachers", + eligibility_criteria_url: "https://www.gov.uk/guidance/levelling-up-premium-payments-for-teachers#eligibility-criteria", payment_and_deductions_info_url: "https://www.gov.uk/guidance/levelling-up-premium-payments-for-teachers#payments-and-deductions" ) } diff --git a/spec/models/policies/early_career_payments/policy_eligibility_checker_spec.rb b/spec/models/policies/early_career_payments/policy_eligibility_checker_spec.rb index e63522ca38..2c93460015 100644 --- a/spec/models/policies/early_career_payments/policy_eligibility_checker_spec.rb +++ b/spec/models/policies/early_career_payments/policy_eligibility_checker_spec.rb @@ -72,7 +72,9 @@ end describe "#status" do - before { create(:journey_configuration, :additional_payments) } + let(:claim_year) { AcademicYear.new(2022) } + + before { create(:journey_configuration, :additional_payments, current_academic_year: claim_year) } subject { policy_eligibility_checker.status } @@ -111,14 +113,16 @@ end context "induction not completed" do - context "with an ECP-only eligible school" do - let(:answers) { build(:additional_payments_answers, :ecp_eligible, induction_completed: false) } + let(:answers) { build(:additional_payments_answers, :ecp_eligible, :eligible_school_ecp_only, induction_completed: false) } + + context "when the claim year is not the same as the end policy year" do + let(:claim_year) { Policies::EarlyCareerPayments::POLICY_END_YEAR - 1 } it { is_expected.to eq(:eligible_later) } end - context "with an ECP and LUP eligible school" do - let(:answers) { build(:additional_payments_answers, :ecp_eligible, :eligible_school_ecp_and_lup, induction_completed: false) } + context "when the claim year is the same as the end policy year" do + let(:claim_year) { Policies::EarlyCareerPayments::POLICY_END_YEAR } it { is_expected.to eq(:ineligible) } end