Skip to content

Commit

Permalink
[CPDLP-3933] Updated CreateNewECFCohort with CreateMentorCallOffContract
Browse files Browse the repository at this point in the history
  • Loading branch information
mooktakim committed Jan 16, 2025
1 parent eb41ced commit 11dc2bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/services/importers/create_new_ecf_cohort.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ def call

private

attr_reader :cohort_csv, :cohort_lead_provider_csv, :contract_csv, :schedule_csv, :statement_csv, :logger
attr_reader :cohort_csv, :cohort_lead_provider_csv, :contract_csv, :mentor_contract_csv, :schedule_csv, :statement_csv, :logger

def initialize(cohort_csv:, cohort_lead_provider_csv:, contract_csv:, schedule_csv:, statement_csv:, logger: Rails.logger)
def initialize(cohort_csv:, cohort_lead_provider_csv:, contract_csv:, mentor_contract_csv:, schedule_csv:, statement_csv:, logger: Rails.logger)
@cohort_csv = cohort_csv
@cohort_lead_provider_csv = cohort_lead_provider_csv
@contract_csv = contract_csv
@mentor_contract_csv = mentor_contract_csv
@schedule_csv = schedule_csv
@statement_csv = statement_csv
@logger = logger
Expand All @@ -39,6 +40,9 @@ def run_ecf_cohort_scripts
logger.info "CreateNewECFCohort: Running CreateCallOffContract with: '#{contract_csv}'"
CreateCallOffContract.new(path_to_csv: contract_csv).call

logger.info "CreateNewECFCohort: Running CreateMentorCallOffContract with: '#{mentor_contract_csv}'"
CreateMentorCallOffContract.new(path_to_csv: mentor_contract_csv).call

logger.info "CreateNewECFCohort: Running CreateSchedule with: '#{schedule_csv}'"
CreateSchedule.new(path_to_csv: schedule_csv).call

Expand Down
2 changes: 2 additions & 0 deletions spec/fixtures/files/importers/mentor_contract_csv_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lead-provider-name,cohort-start-year,recruitment-target,payment-per-participant
Ambition Institute,2026,4600,1000.0
5 changes: 4 additions & 1 deletion spec/services/importers/create_new_ecf_cohort_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
let(:cohort_csv) { "spec/fixtures/files/importers/cohort_csv_data.csv" }
let(:cohort_lead_provider_csv) { "spec/fixtures/files/importers/cohort_lead_provider_csv_data.csv" }
let(:contract_csv) { "spec/fixtures/files/importers/contract_csv_data.csv" }
let(:mentor_contract_csv) { "spec/fixtures/files/importers/mentor_contract_csv_data.csv" }
let(:schedule_csv) { "spec/fixtures/files/importers/schedule_csv_data.csv" }
let(:statement_csv) { "spec/fixtures/files/importers/statement_csv_data.csv" }
let(:lead_provider) { create(:lead_provider, name: "Ambition Institute", cohorts: []) }
let!(:cpd_lead_provider) { create(:cpd_lead_provider, name: "Ambition Institute", lead_provider:) }

subject do
described_class.new(cohort_csv:, cohort_lead_provider_csv:, contract_csv:, schedule_csv:, statement_csv:)
described_class.new(cohort_csv:, cohort_lead_provider_csv:, contract_csv:, mentor_contract_csv:, schedule_csv:, statement_csv:)
end

context "with missing csvs" do
Expand All @@ -40,9 +41,11 @@

it "creates Call off Contract and bands" do
expect(CallOffContract.count).to eql(0)
expect(MentorCallOffContract.count).to eql(0)
expect(ParticipantBand.count).to eql(0)
subject.call
expect(CallOffContract.count).to eql(1)
expect(MentorCallOffContract.count).to eql(1)
expect(ParticipantBand.count).to eql(4)
end

Expand Down

0 comments on commit 11dc2bf

Please sign in to comment.