Skip to content

Commit

Permalink
CAPT-1419 ECP exit screen showing incorrect text for AY24-25 (when in…
Browse files Browse the repository at this point in the history
…duction 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 <[email protected]>
  • Loading branch information
your and slorek authored Jun 26, 2024
1 parent 4dfb780 commit 00c0d9a
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 33 deletions.
10 changes: 9 additions & 1 deletion app/models/concerns/eligibility_checkable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions app/models/policies/early_career_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions app/models/policies/early_career_payments/eligibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
# {
Expand All @@ -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)})

Expand Down
5 changes: 4 additions & 1 deletion app/models/policies/levelling_up_premium_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
# {
Expand All @@ -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)})

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p class="govuk-body">
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.
</p>
<p class="govuk-body">
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.
</p>

<p class="govuk-body">
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") %>.
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -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.
</p>

Expand Down
13 changes: 11 additions & 2 deletions lib/ineligibility_reason_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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?,
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
21 changes: 21 additions & 0 deletions spec/features/ineligible_early_career_payments_claims_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions spec/models/early_career_payments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/levelling_up_premium_payments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 00c0d9a

Please sign in to comment.