Skip to content

Commit

Permalink
wip running ci
Browse files Browse the repository at this point in the history
  • Loading branch information
rjlynch committed Dec 5, 2024
1 parent 682d4e3 commit b13247f
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ def eligible_now_or_later

private

# not sure about these changess, could we potentially pick a policy
# that isn't actually eligible?
def eligibilities
eligibility_checker.potentially_still_eligible.map do |policy|
policy::Eligibility.new.tap do |eligibility|
set_eligibility_attributes(eligibility)
calculate_award_amount(eligibility)
end
end
end

def eligibility_checker
@eligibility_checker ||= Journeys::EligibilityChecker.new(journey_session: journey_session)
end
Expand All @@ -20,6 +31,8 @@ def main_eligibility
def main_policy
if answers.selected_claim_policy.present?
answers.selected_claim_policy
elsif eligibilities.one?
eligibilities.first.policy
else
Policies::EarlyCareerPayments
end
Expand Down
5 changes: 5 additions & 0 deletions app/models/concerns/eligibility_checkable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def trainee_teacher?

def common_ineligible_attributes?
[
policy_closed?,
indicated_ineligible_school?,
supply_teacher_lacking_either_long_contract_or_direct_employment?,
poor_performance?,
Expand All @@ -59,6 +60,10 @@ def common_ineligible_attributes?
].any?
end

def policy_closed?
policy.closed?(claim_year)
end

def indicated_ineligible_school?
current_school.present? && !policy::SchoolEligibility.new(current_school).eligible?
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/policies/early_career_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,9 @@ def future_years(year)
def selectable_itt_years_for_claim_year(claim_year)
(AcademicYear.new(claim_year - 5)...AcademicYear.new(claim_year)).to_a
end

def closed?(claim_year)
claim_year > POLICY_END_YEAR
end
end
end
4 changes: 4 additions & 0 deletions app/models/policies/levelling_up_premium_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,9 @@ def future_years(year)
def selectable_itt_years_for_claim_year(claim_year)
(AcademicYear.new(claim_year - 5)...AcademicYear.new(claim_year)).to_a
end

def closed?(claim_year)
claim_year > POLICY_END_YEAR
end
end
end
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 the policy has now closed.
</p>
<p class="govuk-body">
You are not eligible for the
<%= link_to("#{I18n.t("levelling_up_premium_payments.policy_short_name").downcase} (opens in new tab)", Policies::LevellingUpPremiumPayments.eligibility_criteria_url, class: "govuk-link", target: "_blank") %>
because the school you teach in is not eligible. <%= I18n.t("levelling_up_premium_payments.policy_short_name").capitalize.pluralize %> 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(I18n.t("levelling_up_premium_payments.policy_short_name").downcase.pluralize, Policies::LevellingUpPremiumPayments.eligibility_criteria_url, class: "govuk-link") %>.
</p>
13 changes: 12 additions & 1 deletion lib/ineligibility_reason_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ def initialize(answers)
end

def reason
if current_school?
if ecp_only_and_ecp_closed?
:ecp_only_ecp_closed
elsif current_school?
:current_school
elsif dqt_data_ineligible?
:dqt_data_ineligible
Expand Down Expand Up @@ -41,6 +43,15 @@ def reason

private

def ecp_only_and_ecp_closed?
school = @answers.current_school

[
Policies::EarlyCareerPayments::SchoolEligibility.new(school).eligible?,
!Policies::LevellingUpPremiumPayments::SchoolEligibility.new(school).eligible?
].all? && Policies::EarlyCareerPayments.closed?(@answers.policy_year)
end

def current_school?
school = @answers.current_school

Expand Down
86 changes: 84 additions & 2 deletions spec/features/combined_teacher_claim_journey_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
end
let(:eligibility) { claim.eligibility }

before { create(:journey_configuration, :additional_payments, current_academic_year: AcademicYear.new(2023)) }

scenario "Eligible for both" do
create(:journey_configuration, :additional_payments, current_academic_year: AcademicYear.new(2023))

school = create(:school, :combined_journey_eligibile_for_all)

visit new_claim_path(Journeys::AdditionalPaymentsForTeaching::ROUTING_NAME)
Expand Down Expand Up @@ -243,6 +243,8 @@
end

scenario "Eligible for only one" do
create(:journey_configuration, :additional_payments, current_academic_year: AcademicYear.new(2023))

school = create(:school, :early_career_payments_uplifted)

visit new_claim_path(Journeys::AdditionalPaymentsForTeaching::ROUTING_NAME)
Expand Down Expand Up @@ -323,4 +325,84 @@
expect(page).not_to have_selector('input[type="radio"]')
expect(page).to have_button("Apply now")
end

context "when ECP is closed" do
before do
create(
:journey_configuration,
:additional_payments,
current_academic_year: AcademicYear.new(2025)
)
end

scenario "choosing an ecp only school is ineligible" do
school = create(:school, :early_career_payments_eligible)

visit new_claim_path(Journeys::AdditionalPaymentsForTeaching::ROUTING_NAME)

click_on "Continue without signing"

choose_school school

expect(page).to have_content "You are not eligible"
expect(page).to have_content "the policy has now closed"
end

scenario "choosing a lup eligible school allows completing the journey" do
school = create(:school, :combined_journey_eligibile_for_all)

visit new_claim_path(Journeys::AdditionalPaymentsForTeaching::ROUTING_NAME)

click_on "Continue without signing"

choose_school school
click_on "Continue"

# - Have you started your first year as a newly qualified teacher?
choose "Yes"
click_on "Continue"

# - Have you completed your induction as an early-career teacher?
choose "Yes"
click_on "Continue"

# - Are you currently employed as a supply teacher
choose "No"
click_on "Continue"

# - Poor performance
within all(".govuk-fieldset")[0] do
choose("No")
end
within all(".govuk-fieldset")[1] do
choose("No")
end
click_on "Continue"

# - What route into teaching did you take?
choose("Undergraduate initial teacher training (ITT)")
click_on "Continue"

# - In which academic year did you complete your undergraduate ITT?
choose("2024 to 2025")
click_on "Continue"

# - Which subject did you do your undergraduate ITT in
choose "Mathematics"
click_on "Continue"

# Do you spend at least half of your contracted hours teaching eligible
# subjects?
choose "Yes"
click_on "Continue"

# Check your answers
click_on "Continue"

expect(page).to have_content("You’re eligible for an additional payment")
expect(page).to have_content(
"you can apply for a school targeted retention incentive"
)
end
end
end

0 comments on commit b13247f

Please sign in to comment.