Skip to content

Commit

Permalink
Update rendering of NPQ names in Check
Browse files Browse the repository at this point in the history
Currently the Qualifications API returns the NPQ name in the following
form:

"National Professional Qualification (NPQ) for [name of NPQ]"

We want to remove the acronym expansion at the start so we can use the
actual name of the qualification in a field heading.

Add a gsub to remove the prefix if it is present.
  • Loading branch information
malcolmbaig committed Nov 14, 2023
1 parent 5e71019 commit 3dda650
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion app/components/check_records/npq_summary_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ def rows
npqs.map do |npq|
{
key: {
text: ["Date", npq.name, "awarded"].join(" ")
text: key_text(npq)
},
value: {
text: npq.awarded_at.to_fs(:long_uk)
}
}
end
end

private

def key_text(npq)
tidied_name = npq.name.gsub(/National Professional Qualification \(NPQ\) for /, '')
"Date NPQ for #{tidied_name} awarded"
end
end
2 changes: 1 addition & 1 deletion spec/support/fake_qualifications_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def quals_data(trn: nil, itt: true)
certificateUrl: "/v3/certificates/npq/missing",
type: {
code: "NPQSL",
name: "NPQ senior leadership"
name: "National Professional Qualification (NPQ) for Early Years Leadership"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def then_i_see_itt_details
end

def then_i_see_npq_details
expect(page).to have_content("Date NPQ headteacher awarded")
expect(page).to have_content("Date NPQ for Early Years Leadership awarded")
expect(page).to have_content("27 February 2023")
end

Expand Down

0 comments on commit 3dda650

Please sign in to comment.