Skip to content

Commit

Permalink
Merge branch 'master' into rm-zip
Browse files Browse the repository at this point in the history
  • Loading branch information
slorek authored Dec 20, 2024
2 parents 857c84d + dd05100 commit c0ada62
Show file tree
Hide file tree
Showing 52 changed files with 1,176 additions and 1,706 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ GEM
rouge
sprockets (>= 3)
sprockets-rails
hashdiff (1.1.0)
hashdiff (1.1.2)
hashie (5.0.0)
html-attributes-utils (1.0.2)
activesupport (>= 6.1.4.4)
Expand All @@ -297,7 +297,7 @@ GEM
aes_key_wrap
bindata
httpclient
jwt (2.9.1)
jwt (2.9.3)
base64
kramdown (2.5.1)
rexml (>= 3.3.9)
Expand Down Expand Up @@ -591,7 +591,7 @@ GEM
parser (3.3.6.0)
ast (~> 2.4.1)
racc
pg (1.5.7)
pg (1.5.9)
plek (5.2.0)
prometheus_exporter (2.1.1)
webrick
Expand Down Expand Up @@ -831,7 +831,7 @@ GEM
webfinger (1.2.0)
activesupport
httpclient (>= 2.4)
webmock (3.23.1)
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ class ApplicationController < ActionController::Base

helper_method :timeout_warning_in_minutes

def handle_unwanted_requests
render file: Rails.root.join("public", "404.html"), status: :not_found, layout: false
end

private

def timeout_warning_in_minutes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,23 @@ def chemistry_or_physics_available?
end

def subject_symbols
@subject_symbols ||=
JourneySubjectEligibilityChecker.selectable_subject_symbols(answers)
return [] if answers.itt_academic_year&.none?

if 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: answers.policy_year,
itt_year: answers.itt_academic_year
)
end.flatten.uniq
elsif 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 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.

Loading

0 comments on commit c0ada62

Please sign in to comment.