Skip to content

Commit

Permalink
Merge pull request #3415 from DFE-Digital/CAPT-1995/remove-ecp
Browse files Browse the repository at this point in the history
CAPT 1995/remove ecp
  • Loading branch information
rjlynch authored Dec 11, 2024
2 parents da5cc90 + 5650863 commit 7da4806
Show file tree
Hide file tree
Showing 42 changed files with 1,071 additions and 1,685 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def chemistry_or_physics_available?

def subject_symbols
@subject_symbols ||=
JourneySubjectEligibilityChecker.selectable_subject_symbols(answers)
AdditionalPaymentsForTeaching.selectable_subject_symbols(journey_session)
end

def save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def qualification_is?(*symbols)
end

def selectable_itt_years_for_claim_year
JourneySubjectEligibilityChecker.selectable_itt_years_for_claim_year(
AdditionalPaymentsForTeaching.selectable_itt_years_for_claim_year(
journey.configuration.current_academic_year
)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module Journeys
module AdditionalPaymentsForTeaching
class NqtInAcademicYearAfterIttForm < Form
include EligibilityCheckable

attribute :nqt_in_academic_year_after_itt, :boolean

validates :nqt_in_academic_year_after_itt, inclusion: {in: [true, false], message: i18n_error_message(:inclusion)}
Expand All @@ -23,6 +21,10 @@ def save

private

def trainee_teacher?
nqt_in_academic_year_after_itt == false
end

def determine_induction_answer_from_dqt_record
return unless passed_details_check_with_teacher_id?
# We can derive the induction_completed value for current_claim using the
Expand Down
9 changes: 5 additions & 4 deletions app/helpers/claims/itt_subject_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require "journey_subject_eligibility_checker"

module Claims
module IttSubjectHelper
def subjects_to_sentence_for_hint_text(answers)
all_ecp_subjects = [:chemistry, :foreign_languages, :mathematics, :physics]
all_lup_subjects = JourneySubjectEligibilityChecker.fixed_lup_subject_symbols
all_ecp_subjects = Policies::EarlyCareerPayments.subject_symbols(
claim_year: answers.policy_year,
itt_year: answers.itt_academic_year
)
all_lup_subjects = Policies::LevellingUpPremiumPayments.fixed_subject_symbols

hint_subject_symbols = Set[]

Expand Down
12 changes: 11 additions & 1 deletion app/models/academic_year.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def for(date)
new(date.year)
end
end

def wrap(value)
return value if value.is_a? AcademicYear

new(value)
end
end

def initialize(year_or_academic_year_or_string = nil)
Expand Down Expand Up @@ -101,8 +107,12 @@ def eql?(other)
to_s == other.to_s
end

def none?
[start_year, end_year].include? nil
end

def to_s(format = :default)
return "None" if [start_year, end_year].include? nil
return "None" if none?

if format == :long
"#{start_year} to #{end_year}"
Expand Down
28 changes: 20 additions & 8 deletions app/models/concerns/eligibility_checkable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module EligibilityCheckable

FIRST_COMBINED_ECP_AND_LUP_POLICY_YEAR = AcademicYear.new(2022)
FINAL_COMBINED_ECP_AND_LUP_POLICY_YEAR = AcademicYear.new(2024)
FINAL_LUP_POLICY_YEAR = AcademicYear.new(2025)
COMBINED_ECP_AND_LUP_POLICY_YEARS = FIRST_COMBINED_ECP_AND_LUP_POLICY_YEAR..FINAL_COMBINED_ECP_AND_LUP_POLICY_YEAR
COMBINED_ECP_AND_LUP_POLICY_YEARS_BEFORE_FINAL_YEAR = FIRST_COMBINED_ECP_AND_LUP_POLICY_YEAR...FINAL_COMBINED_ECP_AND_LUP_POLICY_YEAR

Expand Down Expand Up @@ -50,7 +49,19 @@ def trainee_teacher?
private

def common_ineligible_attributes?
[indicated_ineligible_school?, trainee_teacher?, supply_teacher_lacking_either_long_contract_or_direct_employment?, poor_performance?, no_selectable_subjects?, ineligible_cohort?, insufficient_teaching?].any?
[
policy_closed?,
indicated_ineligible_school?,
supply_teacher_lacking_either_long_contract_or_direct_employment?,
poor_performance?,
no_selectable_subjects?,
ineligible_cohort?,
insufficient_teaching?
].any?
end

def policy_closed?
policy.closed?(claim_year)
end

def indicated_ineligible_school?
Expand All @@ -66,19 +77,20 @@ def poor_performance?
end

def no_selectable_subjects?
args = {claim_year: claim_year, itt_year: itt_academic_year}

if args.values.any?(&:blank?)
if claim_year.blank? || itt_academic_year.blank?
false
else
JourneySubjectEligibilityChecker.new(**args).current_and_future_subject_symbols(policy).empty?
policy.current_and_future_subject_symbols(
claim_year: claim_year,
itt_year: itt_academic_year
).empty?
end
end

def ineligible_cohort?
return false if itt_academic_year.nil?

eligible_itt_years = JourneySubjectEligibilityChecker.selectable_itt_years_for_claim_year(claim_year)
eligible_itt_years = policy.selectable_itt_years_for_claim_year(claim_year)
!itt_academic_year.in? eligible_itt_years
end

Expand Down Expand Up @@ -113,7 +125,7 @@ def good_performance?
def eligible_cohort?
return false if itt_academic_year.nil?

eligible_itt_years = JourneySubjectEligibilityChecker.selectable_itt_years_for_claim_year(claim_year)
eligible_itt_years = policy.selectable_itt_years_for_claim_year(claim_year)
itt_academic_year.in? eligible_itt_years
end

Expand Down
94 changes: 0 additions & 94 deletions app/models/concerns/policies/early_career_payments/eligible.rb

This file was deleted.

This file was deleted.

37 changes: 28 additions & 9 deletions app/models/journeys/additional_payments_for_teaching.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,43 @@ module AdditionalPaymentsForTeaching
}
}.freeze

def final_policy_year(policy)
{
Policies::EarlyCareerPayments => EligibilityCheckable::FINAL_COMBINED_ECP_AND_LUP_POLICY_YEAR,
Policies::LevellingUpPremiumPayments => EligibilityCheckable::FINAL_LUP_POLICY_YEAR
}[policy]
end

def set_a_reminder?(itt_academic_year:, policy:)
policy_year = configuration.current_academic_year
return false if policy_year >= final_policy_year(policy)
return false if policy_year >= policy::POLICY_END_YEAR

next_year = policy_year + 1
eligible_itt_years = JourneySubjectEligibilityChecker.selectable_itt_years_for_claim_year(next_year)
eligible_itt_years = selectable_itt_years_for_claim_year(next_year)
eligible_itt_years.include?(itt_academic_year)
end

def requires_student_loan_details?
true
end

def selectable_subject_symbols(journey_session)
return [] if journey_session.answers.itt_academic_year&.none?

if journey_session.answers.nqt_in_academic_year_after_itt
EligibilityChecker.new(journey_session: journey_session)
.potentially_still_eligible.map do |policy|
policy.current_and_future_subject_symbols(
claim_year: journey_session.answers.policy_year,
itt_year: journey_session.answers.itt_academic_year
)
end.flatten.uniq
elsif journey_session.answers.policy_year.in?(Policies::LevellingUpPremiumPayments::POLICY_RANGE)
# they get the standard, unchanging LUP subject set because they won't have qualified in time for ECP by 2022/2023
# and they won't have given an ITT year
Policies::LevellingUpPremiumPayments.fixed_subject_symbols
else
[]
end
end

def selectable_itt_years_for_claim_year(claim_year)
POLICIES.flat_map do |policy|
policy.selectable_itt_years_for_claim_year(claim_year)
end.uniq
end
end
end
Loading

0 comments on commit 7da4806

Please sign in to comment.