Skip to content

Commit

Permalink
Revert "Remove CBL data from CTR"
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpattinson authored Sep 16, 2024
1 parent 82ff545 commit d3953b4
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 23 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,6 @@ jobs:
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
pull-request-number: ${{ github.event.number }}

- uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Set kubelogin environment
uses: DFE-Digital/github-actions/set-kubelogin-environment@master
with:
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}

- name: Seed role codes
shell: bash
run: |
make ci aks-review get-cluster-credentials PR_NUMBER=123
kubectl exec -n tra-development deployment/access-your-teaching-qualifications-pr-${{ github.event.number }} -- /bin/sh -c "cd /app && bundle exec rake db:seed_role_codes"
- name: Post comment to Pull Request ${{ github.event.number }}
uses: marocchino/sticky-pull-request-comment@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ gem "bootsnap", require: false
gem "console1984"
gem "cssbundling-rails"
gem "data_migrate", github: "ilyakatz/data-migrate"
gem "dfe-analytics", github: "DFE-Digital/dfe-analytics", tag: "v1.14.2"
gem "dfe-analytics", github: "DFE-Digital/dfe-analytics", tag: "v1.14.1"
gem "faraday"
gem "govuk-components", "~> 5.6"
gem "govuk_design_system_formbuilder", "~> 5.6"
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GIT
remote: https://github.com/DFE-Digital/dfe-analytics.git
revision: 706595e52fed211cee53ad99ceaeaabb47a059cc
tag: v1.14.2
revision: 79378cc466a40c6a6cba317e232cbf48ec79ab7d
tag: v1.14.1
specs:
dfe-analytics (1.14.2)
dfe-analytics (1.14.1)
google-cloud-bigquery (~> 1.38)
httparty (~> 0.21)
multi_xml (~> 0.6.0)
Expand Down
11 changes: 11 additions & 0 deletions app/components/check_records/teacher_profile_summary_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def initialize(teacher)
end

def build_tags
append_restriction_tag
append_teaching_status_tag
append_induction_tag
end
Expand All @@ -20,6 +21,16 @@ def build_tags

delegate :no_restrictions?, :possible_restrictions?, to: :teacher

def append_restriction_tag
tags << if no_restrictions?
{ message: 'No restrictions', colour: 'green'}
elsif possible_restrictions?
{ message: 'Possible restrictions', colour: 'blue'}
else
{ message: 'Restriction', colour: 'red'}
end
end

def append_teaching_status_tag
tags << if teacher.qts_awarded?
{ message: 'QTS', colour: 'green'}
Expand Down
5 changes: 5 additions & 0 deletions app/lib/qualifications_api/teacher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def qualifications

def restriction_status
return 'No restrictions' if no_restrictions?
return 'Possible restrictions' if possible_restrictions?

'Restriction'
end
Expand All @@ -51,6 +52,10 @@ def no_restrictions?
false
end

def possible_restrictions?
sanctions.any?(&:possible_match_on_childrens_barred_list?)
end

def sanctions
api_data.sanctions&.map { |sanction| Sanction.new(sanction) }
end
Expand Down
10 changes: 10 additions & 0 deletions app/models/sanction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ def initialize(api_data)
Call the Teaching Regulation Agency (TRA) on 0207 593 5393 for more information.
DESCRIPTION
},
"G1" => {
title: "Possible match on the children’s barred list",
description: <<~DESCRIPTION.chomp
Email the Disclosure and Barring Service (DBS) at [[email protected]](mailto:[email protected]) to check if this person is allowed to work with children.
DESCRIPTION
},
"T1" => {
title: "Prohibition order",
description: <<~DESCRIPTION.chomp
Expand Down Expand Up @@ -229,6 +235,10 @@ def title
SANCTIONS[code][:title] if SANCTIONS[code]
end

def possible_match_on_childrens_barred_list?
code == "G3"
end

def guilty_but_not_prohibited?
code == "T6"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,45 @@
end
end
end

describe 'restrictions statuses' do
describe "No restrictions tag" do
context "teacher#no_restrictions is true" do
before { allow(teacher).to receive(:no_restrictions?).and_return(true) }

it "adds the No restrictions tag" do
render_inline described_class.new(teacher)

expect(page).to have_text("No restrictions")
end
end

context "teacher#no_restrictions returns false " do
before do
allow(teacher).to receive(:no_restrictions?).and_return(false)
allow(teacher).to receive(:possible_restrictions?).and_return(true)
end

it "adds the possible restriction tag" do
render_inline described_class.new(teacher)

expect(page).to have_text("Possible restriction")
end
end

context "teacher has a restriction" do
before do
allow(teacher).to receive(:no_restrictions?).and_return(false)
allow(teacher).to receive(:possible_restrictions?).and_return(false)
end

it "adds the restriction tag" do
render_inline described_class.new(teacher)

expect(page).to have_text("Restriction")
end
end
end
end
end
end
5 changes: 3 additions & 2 deletions spec/models/sanction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
subject(:description) { sanction.description }

context 'when type exists in SANCTIONS' do
let(:code) { "A13" }
let(:code) { "G1" }

it "returns the description as markdown" do
expect(description)
.to include('Suspended by the General Teaching Council for England.')
.to eq('Email the Disclosure and Barring Service (DBS) at [[email protected]](mailto:[email protected]) ' \
'to check if this person is allowed to work with children.')
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
then_i_see_the_restriction_on_the_result

when_i_click_on_the_result
then_i_see_the_details_of_the_record
then_i_see_the_details_of_the_restriction
end

private
Expand All @@ -35,7 +35,8 @@ def when_i_click_on_the_result
click_link "Teacher Restricted"
end

def then_i_see_the_details_of_the_record
def then_i_see_the_details_of_the_restriction
expect(page).to have_content("Possible match on the children’s barred list")
expect(page).to have_title("Terry Walsh - Check a teacher’s record")
end
end

0 comments on commit d3953b4

Please sign in to comment.