Skip to content

Commit

Permalink
Merge pull request #761 from DFE-Digital/blank-record
Browse files Browse the repository at this point in the history
Add a warning message for when there are no details
  • Loading branch information
felixclack authored Jul 30, 2024
2 parents d18313c + c09d963 commit df2a9ed
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 7 deletions.
8 changes: 8 additions & 0 deletions app/lib/qualifications_api/teacher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def pending_date_of_birth_change?
api_data.pending_date_of_birth_change == true
end

def no_details?
qualifications.empty? &&
api_data.induction.blank? &&
api_data.eyps.blank? &&
api_data.qts.blank? &&
api_data.eyts.blank?
end

private

def add_qts
Expand Down
4 changes: 3 additions & 1 deletion app/views/check_records/teachers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
<% end %>
<% end %>


<% if @teacher.no_details? %>
<%= govuk_warning_text(text: "We have no details of this person's qualifications, teacher status or induction status. Please contact them directly for this information.") %>
<% end %>
<% if @mqs.present? %>
<%= render CheckRecords::MqSummaryComponent.new(mqs: @mqs) %>
<% end %>
Expand Down
16 changes: 14 additions & 2 deletions spec/support/fake_qualifications_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class FakeQualificationsApi < Sinatra::Base
total: 2,
results: [teacher_data, additional_teacher]
}.to_json
when "No_data"
{
total: 1,
results: [no_data]
}.to_json
else
{
total: 1,
Expand All @@ -56,10 +61,13 @@ class FakeQualificationsApi < Sinatra::Base
trn = params[:trn]
case bearer_token
when "token"
if trn == "1234567"
case trn
when "1234567"
quals_data(trn: "1234567").to_json
elsif trn == "987654321"
when "987654321"
quals_data(trn:).to_json
when "1212121"
no_data.to_json
else
halt 404
end
Expand Down Expand Up @@ -114,6 +122,10 @@ def teacher_data(sanctions: false, trn: "1234567")
sanctions ? sanctions_data : no_sanctions_data(trn:)
end

def no_data
no_sanctions_data(trn: "1212121")
end

def no_sanctions_data(trn:)
{
dateOfBirth: "2000-01-01",
Expand Down
17 changes: 17 additions & 0 deletions spec/support/fake_qualifications_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,21 @@ def quals_data(trn: nil, itt: true)
sanctions: trn == "987654321" ? [ { code: "G1", startDate: "2020-10-25" } ] : []
}
end

def no_data(trn:)
{
trn:,
dateOfBirth: "2000-01-01",
firstName: "Terry",
lastName: "Walsh",
previousNames: [],
eyts: nil,
qts: nil,
induction: nil,
initialTeacherTraining: nil,
mandatoryQualifications: [],
npqQualifications: [],
sanctions: []
}
end
end
4 changes: 4 additions & 0 deletions spec/support/system/activate_features_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ def given_the_support_service_is_open
def given_onelogin_authentication_is_active
FeatureFlags::FeatureFlag.activate(:one_login)
end

def given_the_trn_search_feature_is_active
FeatureFlags::FeatureFlag.activate(:trn_search)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@

private

def given_the_trn_search_feature_is_active
FeatureFlags::FeatureFlag.activate(:trn_search)
end

def and_search_with_a_valid_name_and_dob
fill_in "Last name", with: "Multiple_results"
fill_in "Day", with: "5"
Expand Down
41 changes: 41 additions & 0 deletions spec/system/check_records/user_searches_no_details_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'rails_helper'

RSpec.describe "Teacher search", host: :check_records, type: :system do
include ActivateFeaturesSteps
include AuthenticationSteps

scenario "User searches for someone that has a record but no details",
test: %i[with_stubbed_auth with_fake_quals_api] do
given_the_check_service_is_open
when_i_sign_in_via_dsi
and_search_with_a_valid_name_and_dob
then_i_see_a_teacher_record_in_the_results

when_i_click_on_the_teacher_record
then_i_see_this_teacher_has_no_details
end

private

def and_search_with_a_valid_name_and_dob
fill_in "Last name", with: "No_data"
fill_in "Day", with: "5"
fill_in "Month", with: "April"
fill_in "Year", with: "1992"
click_button "Find record"
end

def then_i_see_a_teacher_record_in_the_results
expect(page).to have_content "Terry John Walsh"
end

def when_i_click_on_the_teacher_record
click_on "Terry John Walsh"
end

def then_i_see_this_teacher_has_no_details
expect(page).to have_content(
"We have no details of this person's qualifications, teacher status or induction status."
)
end
end

0 comments on commit df2a9ed

Please sign in to comment.