Skip to content

Commit

Permalink
Merge pull request #762 from DFE-Digital/programme-type
Browse files Browse the repository at this point in the history
Add support for programme type as an Integer
  • Loading branch information
richardpattinson authored Aug 1, 2024
2 parents df2a9ed + 28a005d commit 7346bad
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/lib/qualifications_api/teacher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def add_npq

def add_itt(qts: true)
all_itt_data = api_data.fetch("initial_teacher_training", [])
eyts_itt_data, qts_itt_data = all_itt_data.partition { |itt| itt.programme_type&.starts_with?("EYITT") }
eyts_itt_data, qts_itt_data = all_itt_data.partition { |itt| itt.programme_type.to_s&.starts_with?("EYITT") }
itt_data = qts ? qts_itt_data : eyts_itt_data

@qualifications << itt_data
Expand Down
36 changes: 36 additions & 0 deletions spec/lib/qualifications_api/teacher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,42 @@
expect(qualifications.map(&:type)).to eq(%i[qts itt])
end
end

context "when programmeType is an Integer" do
let(:api_data) do
{
"initialTeacherTraining" => [
{
"qualification" => {
"name" => "BA"
},
"startDate" => "2012-02-28",
"endDate" => "2013-01-28",
"programmeType" => 1,
"programmeTypeDescription" => "Higher Education Institution",
"result" => "Pass",
"ageRange" => {
"description" => "10 to 16 years"
},
"provider" => {
"name" => "Earl Spencer Primary School",
"ukprn" => nil
},
"subjects" => [
{ "code" => "100079", "name" => "business studies" }
]
}
],
"qts" => {
"awarded" => "2013-01-28",
}
}
end

it "the QTS gets priority in the sort order" do
expect(qualifications.map(&:type)).to eq(%i[qts itt])
end
end
end

describe "#name" do
Expand Down

0 comments on commit 7346bad

Please sign in to comment.