From 43bfe327b6632f2864b41758fcb4f93c8f22e358 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Tue, 3 Sep 2024 11:40:33 +0100 Subject: [PATCH 1/2] fix deprecation warning --- app/models/payroll_run.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/payroll_run.rb b/app/models/payroll_run.rb index 2c80007bbf..c65d603c56 100644 --- a/app/models/payroll_run.rb +++ b/app/models/payroll_run.rb @@ -55,7 +55,7 @@ def self.create_with_claims!(claims, topups, attrs = {}) # associates the payment to the Topup, so we know it's payrolled group_topups = grouped_items.select { |i| i.is_a?(Topup) } - award_amount = grouped_items.sum(&:award_amount) + award_amount = grouped_items.map(&:award_amount).compact.sum(0) Payment.create!(payroll_run: payroll_run, claims: grouped_claims, topups: group_topups, award_amount: award_amount) end end From e430dbad3ce1259534b99e7924af78ae78705220 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Tue, 3 Sep 2024 12:27:35 +0100 Subject: [PATCH 2/2] add FE claims to back office --- app/models/claim.rb | 2 +- app/models/policies.rb | 3 +- .../policies/further_education_payments.rb | 3 ++ .../admin_tasks_presenter.rb | 13 +++++++++ .../further_education_payments/eligibility.rb | 2 ++ .../eligibility_admin_answers_presenter.rb | 28 +++++++++++++++++++ config/locales/en.yml | 6 ++++ spec/factories/schools.rb | 2 ++ .../admin/admin_claim_allocation_spec.rb | 17 +++++++++-- spec/models/policies_spec.rb | 6 ++-- ...dmin_view_claim_feature_shared_examples.rb | 2 ++ 11 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 app/models/policies/further_education_payments/admin_tasks_presenter.rb create mode 100644 app/models/policies/further_education_payments/eligibility_admin_answers_presenter.rb diff --git a/app/models/claim.rb b/app/models/claim.rb index 8464457f07..135f4f87a9 100644 --- a/app/models/claim.rb +++ b/app/models/claim.rb @@ -396,7 +396,7 @@ def important_notes end def award_amount_with_topups - topups.sum(:award_amount) + award_amount + topups.sum(:award_amount) + (award_amount || 0) end def must_manually_validate_bank_details? diff --git a/app/models/policies.rb b/app/models/policies.rb index d51f30fa9a..f08416c093 100644 --- a/app/models/policies.rb +++ b/app/models/policies.rb @@ -3,7 +3,8 @@ module Policies StudentLoans, EarlyCareerPayments, LevellingUpPremiumPayments, - InternationalRelocationPayments + InternationalRelocationPayments, + FurtherEducationPayments ].freeze AMENDABLE_ELIGIBILITY_ATTRIBUTES = POLICIES.map do |policy| diff --git a/app/models/policies/further_education_payments.rb b/app/models/policies/further_education_payments.rb index 967c287c49..bfe08cf440 100644 --- a/app/models/policies/further_education_payments.rb +++ b/app/models/policies/further_education_payments.rb @@ -3,6 +3,9 @@ module FurtherEducationPayments include BasePolicy extend self + OTHER_CLAIMABLE_POLICIES = [] + ELIGIBILITY_MATCHING_ATTRIBUTES = [["teacher_reference_number"]].freeze + # Percentage of claims to QA MIN_QA_THRESHOLD = 10 diff --git a/app/models/policies/further_education_payments/admin_tasks_presenter.rb b/app/models/policies/further_education_payments/admin_tasks_presenter.rb new file mode 100644 index 0000000000..dbdf174fb7 --- /dev/null +++ b/app/models/policies/further_education_payments/admin_tasks_presenter.rb @@ -0,0 +1,13 @@ +module Policies + module FurtherEducationPayments + class AdminTasksPresenter + include Admin::PresenterMethods + + attr_reader :claim + + def initialize(claim) + @claim = claim + end + end + end +end diff --git a/app/models/policies/further_education_payments/eligibility.rb b/app/models/policies/further_education_payments/eligibility.rb index 233d9ce9c9..2985ac085e 100644 --- a/app/models/policies/further_education_payments/eligibility.rb +++ b/app/models/policies/further_education_payments/eligibility.rb @@ -1,6 +1,8 @@ module Policies module FurtherEducationPayments class Eligibility < ApplicationRecord + AMENDABLE_ATTRIBUTES = [].freeze + self.table_name = "further_education_payments_eligibilities" class Course < Struct.new(:subject, :name, keyword_init: true) diff --git a/app/models/policies/further_education_payments/eligibility_admin_answers_presenter.rb b/app/models/policies/further_education_payments/eligibility_admin_answers_presenter.rb new file mode 100644 index 0000000000..619f9b5c41 --- /dev/null +++ b/app/models/policies/further_education_payments/eligibility_admin_answers_presenter.rb @@ -0,0 +1,28 @@ +module Policies + module FurtherEducationPayments + class EligibilityAdminAnswersPresenter + include Admin::PresenterMethods + + attr_reader :eligibility + + def initialize(eligibility) + @eligibility = eligibility + end + + def answers + [].tap do |a| + a << current_school + end + end + + private + + def current_school + [ + translate("admin.current_school"), + display_school(eligibility.current_school) + ] + end + end + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml index e4f3618eaa..8856c9ef89 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -827,6 +827,12 @@ en: feedback_email: "FE-Levellingup.PremiumPayments@education.gov.uk" support_email_address: "FE-Levellingup.PremiumPayments@education.gov.uk" claim_subject: "Further education payment" + policy_acronym: FE + policy_short_name: Targeted Retention Incentive Payment For FE Teachers + admin: + task_questions: + matching_details: + title: Is this claim still valid despite having matching details with other claims? forms: ineligible: courses: diff --git a/spec/factories/schools.rb b/spec/factories/schools.rb index 3c5296f0d9..344453c3fb 100644 --- a/spec/factories/schools.rb +++ b/spec/factories/schools.rb @@ -140,6 +140,8 @@ end trait :fe_eligible do + further_education + after(:create) do |school, evaluator| create(:eligible_fe_provider, ukprn: school.ukprn) end diff --git a/spec/features/admin/admin_claim_allocation_spec.rb b/spec/features/admin/admin_claim_allocation_spec.rb index d894dcccc0..38d1938a62 100644 --- a/spec/features/admin/admin_claim_allocation_spec.rb +++ b/spec/features/admin/admin_claim_allocation_spec.rb @@ -1,6 +1,17 @@ require "rails_helper" RSpec.feature "Claims awaiting a decision" do + let(:expected_policy_select_options) do + [ + "All", + "Student Loans", + "Early-Career Payments", + "Levelling Up Premium Payments", + "International Relocation Payments", + "Targeted Retention Incentive Payment For FE Teachers" + ] + end + before do create(:journey_configuration, :student_loans) create(:journey_configuration, :additional_payments) @@ -104,7 +115,7 @@ within("#allocations") do expect(page).to have_select("allocate_to_team_member", options: ["Aaron Admin", "Sarah Strawbridge", "Frank Yee", "Abdul Rafiq"]) - expect(page).to have_select("allocate_to_policy", options: ["All", "Student Loans", "Early-Career Payments", "Levelling Up Premium Payments", "International Relocation Payments"]) + expect(page).to have_select("allocate_to_policy", options: expected_policy_select_options) expect(page).to have_button("Allocate claims", disabled: false) expect(page).to have_button("Unallocate claims") end @@ -182,7 +193,7 @@ within("#allocations") do expect(page).to have_select("allocate_to_team_member", options: ["Aaron Admin", "Sarah Strawbridge", "Frank Yee", "Abdul Rafiq"]) - expect(page).to have_select("allocate_to_policy", options: ["All", "Student Loans", "Early-Career Payments", "Levelling Up Premium Payments", "International Relocation Payments"]) + expect(page).to have_select("allocate_to_policy", options: expected_policy_select_options) expect(page).to have_button("Allocate claims", disabled: false) expect(page).to have_button("Unallocate claims") end @@ -219,7 +230,7 @@ within("#allocations") do expect(page).to have_select("allocate_to_team_member", options: ["Aaron Admin", "Sarah Strawbridge", "Frank Yee", "Abdul Rafiq"]) - expect(page).to have_select("allocate_to_policy", options: ["All", "Student Loans", "Early-Career Payments", "Levelling Up Premium Payments", "International Relocation Payments"]) + expect(page).to have_select("allocate_to_policy", options: expected_policy_select_options) expect(page).to have_button("Allocate claims", disabled: false) expect(page).to have_button("Unallocate claims") end diff --git a/spec/models/policies_spec.rb b/spec/models/policies_spec.rb index 3786b3c6da..947f604a37 100644 --- a/spec/models/policies_spec.rb +++ b/spec/models/policies_spec.rb @@ -7,7 +7,8 @@ Policies::StudentLoans, Policies::EarlyCareerPayments, Policies::LevellingUpPremiumPayments, - Policies::InternationalRelocationPayments + Policies::InternationalRelocationPayments, + Policies::FurtherEducationPayments ]) end end @@ -32,7 +33,8 @@ ["Student Loans", "student-loans"], ["Early-Career Payments", "early-career-payments"], ["Levelling Up Premium Payments", "levelling-up-premium-payments"], - ["International Relocation Payments", "international-relocation-payments"] + ["International Relocation Payments", "international-relocation-payments"], + ["Targeted Retention Incentive Payment For FE Teachers", "further-education-payments"] ]) end end diff --git a/spec/support/admin_view_claim_feature_shared_examples.rb b/spec/support/admin_view_claim_feature_shared_examples.rb index db26b234d1..3842be64d0 100644 --- a/spec/support/admin_view_claim_feature_shared_examples.rb +++ b/spec/support/admin_view_claim_feature_shared_examples.rb @@ -180,6 +180,8 @@ def expect_page_to_have_policy_sections(policy) ["Identity confirmation", "Qualifications", "Induction confirmation", "Census subjects taught", "Employment", "Student loan plan", "Decision"] when Policies::InternationalRelocationPayments ["Identity confirmation", "Visa", "Arrival date", "Employment", "Employment contract", "Employment start", "Subject", "Teaching hours", "Decision"] + when Policies::FurtherEducationPayments + ["Identity confirmation", "Qualifications", "Census subjects taught", "Employment", "Matching details", "Decision"] else raise "Unimplemented policy: #{policy}" end