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 5517e80
Show file tree
Hide file tree
Showing 5 changed files with 39 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
26 changes: 26 additions & 0 deletions db/migrate/20241022110650_generate_payroll_run.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require "faker"
require "factory_bot_rails"
require Rails.application.root.join("lib", "factory_helpers")

class GeneratePayrollRun < ActiveRecord::Migration[7.0]
def change
ApplicationRecord.transaction do
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
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_10_15_121145) do
ActiveRecord::Schema[7.0].define(version: 2024_10_22_110650) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_trgm"
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::Type.new.serialize(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 5517e80

Please sign in to comment.