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 c0ada62 + 4dee58e commit 2063acb
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 319 deletions.
10 changes: 0 additions & 10 deletions app/models/base_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ def payroll_file_name
to_s
end

def policies_claimable
return [] unless const_defined?(:OTHER_CLAIMABLE_POLICIES)

[self] + self::OTHER_CLAIMABLE_POLICIES
end

def policy_eligibilities_claimable
policies_claimable.map { |p| p::Eligibility }
end

def eligibility_matching_attributes
return [] unless const_defined?(:ELIGIBILITY_MATCHING_ATTRIBUTES)

Expand Down
11 changes: 1 addition & 10 deletions app/models/claim/matching_attribute_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def matching_claims
vals = values_for_attributes(@source_claim.eligibility, attributes)
next if vals.blank?

policies_to_find_matches.map do |policy|
Policies::POLICIES.map do |policy|
# Not all eligibility models have the same columns
attributes_to_check = attributes & policy::Eligibility.column_names

Expand Down Expand Up @@ -76,22 +76,13 @@ def matching_attributes(other_claim)

private

def policies_to_find_matches
@source_claim.policy.policies_claimable
end

def eligibility_attributes_groups_to_match
@source_claim.policy.eligibility_matching_attributes
end

def policies_to_find_matches_eligibility_types
policies_to_find_matches.map { |policy| policy::Eligibility.to_s }
end

def claims_to_compare
Claim
.by_academic_year(@source_claim.academic_year)
.by_policies(policies_to_find_matches)
.where.not(id: @source_claim.id)
end

Expand Down
9 changes: 0 additions & 9 deletions app/models/policies/early_career_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ module EarlyCareerPayments
POLICY_START_YEAR = AcademicYear.new(2021).freeze
POLICY_END_YEAR = AcademicYear.new(2024).freeze

# Used in
# - matching claims with multiple policies: MatchingAttributeFinder
OTHER_CLAIMABLE_POLICIES = [
LevellingUpPremiumPayments,
StudentLoans,
FurtherEducationPayments,
EarlyYearsPayments
].freeze

ELIGIBILITY_MATCHING_ATTRIBUTES = [["teacher_reference_number"]].freeze

SEARCHABLE_ELIGIBILITY_ATTRIBUTES = %w[teacher_reference_number].freeze
Expand Down
7 changes: 0 additions & 7 deletions app/models/policies/early_years_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ module EarlyYearsPayments
POLICY_START_DATE = Date.new(2024, 11, 11)
RETENTION_PERIOD = 6.months

OTHER_CLAIMABLE_POLICIES = [
EarlyCareerPayments,
LevellingUpPremiumPayments,
StudentLoans,
FurtherEducationPayments
]

# Percentage of claims to QA
MIN_QA_THRESHOLD = 10

Expand Down
9 changes: 0 additions & 9 deletions app/models/policies/further_education_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ module FurtherEducationPayments
include BasePolicy
extend self

# Used in
# - matching claims with multiple policies: MatchingAttributeFinder
OTHER_CLAIMABLE_POLICIES = [
EarlyCareerPayments,
StudentLoans,
LevellingUpPremiumPayments,
EarlyYearsPayments
]

ELIGIBILITY_MATCHING_ATTRIBUTES = [["teacher_reference_number"]].freeze

# Percentage of claims to QA
Expand Down
1 change: 0 additions & 1 deletion app/models/policies/international_relocation_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module InternationalRelocationPayments
].freeze

ELIGIBILITY_MATCHING_ATTRIBUTES = [["passport_number"]].freeze
OTHER_CLAIMABLE_POLICIES = []

# Percentage of claims to QA
MIN_QA_THRESHOLD = 100
Expand Down
9 changes: 0 additions & 9 deletions app/models/policies/levelling_up_premium_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ module LevellingUpPremiumPayments
AutomatedChecks::ClaimVerifiers::FraudRisk
].freeze

# Used in
# - matching claims with multiple policies: MatchingAttributeFinder
OTHER_CLAIMABLE_POLICIES = [
EarlyCareerPayments,
StudentLoans,
FurtherEducationPayments,
EarlyYearsPayments
].freeze

ELIGIBILITY_MATCHING_ATTRIBUTES = [["teacher_reference_number"]].freeze

SEARCHABLE_ELIGIBILITY_ATTRIBUTES = %w[teacher_reference_number].freeze
Expand Down
9 changes: 0 additions & 9 deletions app/models/policies/student_loans.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ module StudentLoans
POLICY_END_YEAR = AcademicYear.new(2020).freeze
ACADEMIC_YEARS_QUALIFIED_TEACHERS_CAN_CLAIM_FOR = 11

# Used in
# - matching claims with multiple policies: MatchingAttributeFinder
OTHER_CLAIMABLE_POLICIES = [
EarlyCareerPayments,
LevellingUpPremiumPayments,
FurtherEducationPayments,
EarlyYearsPayments
]

ELIGIBILITY_MATCHING_ATTRIBUTES = [["teacher_reference_number"]].freeze

SEARCHABLE_ELIGIBILITY_ATTRIBUTES = %w[teacher_reference_number].freeze
Expand Down
29 changes: 0 additions & 29 deletions spec/models/base_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ module TestPolicy

extend self

OTHER_CLAIMABLE_POLICIES = [
TestPolicyA,
TestPolicyB
].freeze

ELIGIBILITY_MATCHING_ATTRIBUTES = [["some_reference"]].freeze

SEARCHABLE_ELIGIBILITY_ATTRIBUTES = %w[some_searchable_reference].freeze
Expand Down Expand Up @@ -69,30 +64,6 @@ class Eligibility
end
end

describe "::policies_claimable" do
it do
expect(Policies::TestPolicy.policies_claimable).to contain_exactly(
Policies::TestPolicy, Policies::TestPolicyA, Policies::TestPolicyB
)
end

it do
expect(Policies::TestPolicyA.policies_claimable).to be_empty
end
end

describe "::policy_eligibilities_claimable" do
it do
expect(Policies::TestPolicy.policy_eligibilities_claimable).to contain_exactly(
Policies::TestPolicy::Eligibility, Policies::TestPolicyA::Eligibility, Policies::TestPolicyB::Eligibility
)
end

it do
expect(Policies::TestPolicyA.policy_eligibilities_claimable).to be_empty
end
end

describe "::eligibility_matching_attributes" do
it do
expect(Policies::TestPolicy.eligibility_matching_attributes).to contain_exactly(["some_reference"])
Expand Down
Loading

0 comments on commit 2063acb

Please sign in to comment.