diff --git a/app/lib/qualifications_api/teacher.rb b/app/lib/qualifications_api/teacher.rb index 3a5e16ae..9e0a8f49 100644 --- a/app/lib/qualifications_api/teacher.rb +++ b/app/lib/qualifications_api/teacher.rb @@ -77,7 +77,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&.starts_with?("EYITT") } itt_data = qts ? qts_itt_data : eyts_itt_data @qualifications << itt_data diff --git a/spec/lib/qualifications_api/teacher_spec.rb b/spec/lib/qualifications_api/teacher_spec.rb index ef910f20..beb5c689 100644 --- a/spec/lib/qualifications_api/teacher_spec.rb +++ b/spec/lib/qualifications_api/teacher_spec.rb @@ -105,6 +105,16 @@ ) end + it "designates ITT qualifications as QTS if no programme type is present" do + itt_qualification = api_data["initialTeacherTraining"].first + itt_qualification["programmeType"] = nil + api_data["initialTeacherTraining"] = [itt_qualification] + + expect(qualifications.map(&:type)).to eq( + %i[NPQSL NPQML mandatory induction qts itt eyts] + ) + end + context "ITT result field" do before do api_data["initialTeacherTraining"].each { |itt| itt["result"] = "DeferredForSkillsTests" }