Skip to content

Commit

Permalink
Merge pull request #3144 from DFE-Digital/fe-admin-claims
Browse files Browse the repository at this point in the history
FE admin claims
  • Loading branch information
asmega authored Sep 3, 2024
2 parents a06c432 + e430dba commit 2699366
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion app/models/payroll_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/models/policies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module Policies
StudentLoans,
EarlyCareerPayments,
LevellingUpPremiumPayments,
InternationalRelocationPayments
InternationalRelocationPayments,
FurtherEducationPayments
].freeze

AMENDABLE_ELIGIBILITY_ATTRIBUTES = POLICIES.map do |policy|
Expand Down
3 changes: 3 additions & 0 deletions app/models/policies/further_education_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions app/models/policies/further_education_payments/eligibility.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,12 @@ en:
feedback_email: "[email protected]"
support_email_address: "[email protected]"
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:
Expand Down
2 changes: 2 additions & 0 deletions spec/factories/schools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@
end

trait :fe_eligible do
further_education

after(:create) do |school, evaluator|
create(:eligible_fe_provider, ukprn: school.ukprn)
end
Expand Down
17 changes: 14 additions & 3 deletions spec/features/admin/admin_claim_allocation_spec.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions spec/models/policies_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
Policies::StudentLoans,
Policies::EarlyCareerPayments,
Policies::LevellingUpPremiumPayments,
Policies::InternationalRelocationPayments
Policies::InternationalRelocationPayments,
Policies::FurtherEducationPayments
])
end
end
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions spec/support/admin_view_claim_feature_shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2699366

Please sign in to comment.