From f93f6f656de5002ed9f0acd97f473b487fa56415 Mon Sep 17 00:00:00 2001 From: Richard Lynch Date: Wed, 20 Nov 2024 15:27:34 +0000 Subject: [PATCH] Remove more branches from trainee journey Removes the ineligiblity branches from the special case trainee teacher journey. We want all eligibility checking to happen in one place (the policy eligibility checker). This commit updates the mini trainee journey to not check eligibility. This also surfaced a bug in the policy eligiblity checker, a trainee teacher with an ineligible itt subject is not yet ineligible, they may still be eligible later, we don't know until they've entered their degree subject (at least according to the logic in `spec/features/trainee_teacher_subjourney_for_lup_schools_spec.rb:59`) --- app/models/journeys/page_sequence.rb | 12 ++++-------- .../policy_eligibility_checker.rb | 6 +----- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/app/models/journeys/page_sequence.rb b/app/models/journeys/page_sequence.rb index 48c313e810..96a494ead3 100644 --- a/app/models/journeys/page_sequence.rb +++ b/app/models/journeys/page_sequence.rb @@ -20,12 +20,12 @@ def slugs end def next_slug + return "ineligible" if journey_ineligible? + if lup_policy_and_trainee_teacher_at_lup_school? return handle_trainee_teacher end - return "ineligible" if journey_ineligible? - if claim_submittable? return "student-loan-amount" if updating_personal_details? && in_sequence?("student-loan-amount") return "check-your-answers" @@ -98,7 +98,7 @@ def lup_trainee_at_lup_school def handle_trainee_teacher case current_slug when "nqt-in-academic-year-after-itt" - @journey_session.answers.policy_year.in?(EligibilityCheckable::COMBINED_ECP_AND_LUP_POLICY_YEARS_BEFORE_FINAL_YEAR) ? "eligible-itt-subject" : "ineligible" + "eligible-itt-subject" when "eligible-itt-subject" if answers.eligible_itt_subject.to_sym.in? Policies::LevellingUpPremiumPayments.fixed_subject_symbols "future-eligibility" @@ -106,11 +106,7 @@ def handle_trainee_teacher "eligible-degree-subject" end when "eligible-degree-subject" - if @journey_session.answers.eligible_degree_subject? - "future-eligibility" - else - "ineligible" - end + "future-eligibility" end end diff --git a/app/models/policies/levelling_up_premium_payments/policy_eligibility_checker.rb b/app/models/policies/levelling_up_premium_payments/policy_eligibility_checker.rb index 4361b67e76..9eb213964a 100644 --- a/app/models/policies/levelling_up_premium_payments/policy_eligibility_checker.rb +++ b/app/models/policies/levelling_up_premium_payments/policy_eligibility_checker.rb @@ -74,11 +74,7 @@ def eligible_degree? end def specific_ineligible_attributes? - indicated_ecp_only_itt_subject? || trainee_teacher_with_ineligible_itt_subject? || ineligible_itt_subject_and_no_relevant_degree? - end - - def trainee_teacher_with_ineligible_itt_subject? - trainee_teacher? && indicated_ineligible_itt_subject? + indicated_ecp_only_itt_subject? || ineligible_itt_subject_and_no_relevant_degree? end def ineligible_itt_subject_and_no_relevant_degree?