Skip to content

Commit

Permalink
DROP THIS
Browse files Browse the repository at this point in the history
  • Loading branch information
rjlynch committed Oct 22, 2024
1 parent 620cacc commit 33603fd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/models/claim/claims_preventing_payment_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(claim)
# provided by `claim`, and hence `claim` cannot be paid in the same payment
# as the returned claims.
def claims_preventing_payment
@claims_preventing_payment ||= find_claims_preventing_payment
[]
end

private
Expand Down
22 changes: 21 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require "faker"
require "factory_bot_rails"
require Rails.application.root.join("lib", "factory_helpers")
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
Expand Down Expand Up @@ -27,7 +30,24 @@
AcademicYear.current
).run

SchoolDataImporterJob.perform_later if School.count < 100
SchoolDataImporterJob.perform_now if School.count < 100

PayrollRun.destroy_all

FactoryHelpers.create_factory_registry
FactoryHelpers.reset_factory_registry

FactoryBot.create(
:payroll_run,
claims_counts: {
Policies::StudentLoans => 600,
Policies::EarlyCareerPayments => 900,
[Policies::EarlyCareerPayments, Policies::StudentLoans] => 300,
Policies::FurtherEducationPayments => 600,
Policies::InternationalRelocationPayments => 300,
Policies::LevellingUpPremiumPayments => 301
}
)
end

if Rails.env.development?
Expand Down
20 changes: 10 additions & 10 deletions spec/factories/claims.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@

raise "Policy of Claim (#{evaluator.policy}) must match Eligibility class (#{claim.eligibility.policy})" if evaluator.policy != claim.eligibility.policy

claim_academic_year =
if [Policies::EarlyCareerPayments, Policies::LevellingUpPremiumPayments].include?(evaluator.policy)
Journeys::AdditionalPaymentsForTeaching.configuration.current_academic_year
elsif evaluator.policy == Policies::FurtherEducationPayments
Journeys::FurtherEducationPayments.configuration.current_academic_year
else
AcademicYear::Type.new.serialize(AcademicYear.new(2019))
end

claim.academic_year = claim_academic_year unless claim.academic_year_before_type_cast
claim_academic_year = AcademicYear.current
#if [Policies::EarlyCareerPayments, Policies::LevellingUpPremiumPayments].include?(evaluator.policy)
# Journeys::AdditionalPaymentsForTeaching.configuration.current_academic_year
#elsif evaluator.policy == Policies::FurtherEducationPayments
# Journeys::FurtherEducationPayments.configuration.current_academic_year
#else
# AcademicYear::Type.new.serialize(AcademicYear.new(2019))
#end

#claim.academic_year = claim_academic_year unless claim.academic_year_before_type_cast
end

trait :current_academic_year do
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/schools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
journey { nil }
end

sequence(:urn)
sequence(:urn) { |n| School.maximum(:urn).to_i + n }
name { "#{Faker::Company.unique.name} School" }
school_type { :community_school }
school_type_group { :la_maintained }
Expand Down

0 comments on commit 33603fd

Please sign in to comment.