diff --git a/app/models/claim/claims_preventing_payment_finder.rb b/app/models/claim/claims_preventing_payment_finder.rb index 716c1b9092..1668d5de31 100644 --- a/app/models/claim/claims_preventing_payment_finder.rb +++ b/app/models/claim/claims_preventing_payment_finder.rb @@ -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 diff --git a/db/migrate/20241022110650_generate_payroll_run.rb b/db/migrate/20241022110650_generate_payroll_run.rb new file mode 100644 index 0000000000..8431183161 --- /dev/null +++ b/db/migrate/20241022110650_generate_payroll_run.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index cc19519bba..cdcfecb61f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/spec/factories/claims.rb b/spec/factories/claims.rb index 22677ff79c..2756e89819 100644 --- a/spec/factories/claims.rb +++ b/spec/factories/claims.rb @@ -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 diff --git a/spec/factories/schools.rb b/spec/factories/schools.rb index 344453c3fb..06a54c3a82 100644 --- a/spec/factories/schools.rb +++ b/spec/factories/schools.rb @@ -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 }