Skip to content

Commit

Permalink
Merge pull request #2528 from DFE-Digital/AQTS-688-dev-code-architect…
Browse files Browse the repository at this point in the history
…ure-change-dqt-match-column-name

[AQTS-688] Change dqt_match column name to trs_match
  • Loading branch information
Hassanmir92 authored Dec 3, 2024
2 parents 7034579 + 02b3e50 commit 2d36619
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/jobs/update_trs_match_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def perform(application_form)
TRS::Client::FindTeachers.call(application_form:, reverse_name: true)
end

application_form.update!(dqt_match: { teachers: })
application_form.update!(trs_match: { teachers: })

UpdateTRSMatchJob.set(wait: 24.hours).perform_later(application_form)
end
Expand Down
1 change: 1 addition & 0 deletions app/models/application_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# submitted_at :datetime
# teaching_authority_provides_written_statement :boolean default(FALSE), not null
# teaching_qualification_part_of_degree :boolean
# trs_match :jsonb
# withdrawn_at :datetime
# work_history_status :string default("not_started"), not null
# working_days_since_submission :integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def application_form
end

def duplicate_matches
dqt_match.fetch("teachers", dqt_match.present? ? [dqt_match] : [])
trs_match.fetch("teachers", trs_match.present? ? [trs_match] : [])
end

def task_list_sections
Expand Down Expand Up @@ -85,7 +85,7 @@ def management_tasks
attr_reader :params, :current_staff

delegate :assessment,
:dqt_match,
:trs_match,
:teacher,
:teaching_authority_provides_written_statement,
:work_histories,
Expand Down
1 change: 1 addition & 0 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
- teacher_id
- teaching_authority_provides_written_statement
- teaching_qualification_part_of_degree
- trs_match
- updated_at
- withdrawn_at
- work_history_status
Expand Down
1 change: 1 addition & 0 deletions config/analytics_hidden_pii.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- given_names
- registration_number
- dqt_match
- trs_match
:assessments:
- recommendation_assessor_note
:further_information_request_items:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

class AddTRSMatchColumnToApplicationForms < ActiveRecord::Migration[7.2]
def up
add_column :application_forms, :trs_match, :jsonb, default: {}

ApplicationForm.update_all("trs_match = dqt_match")
end

def down
remove_column :application_forms, :trs_match
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions db/scripts/sanitise.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SET
alternative_given_names = '',
alternative_family_name = '',
dqt_match = '{}',
trs_match = '{}',
registration_number = '';

-- AssessmentSectionFailureReason
Expand Down
Binary file modified docs/diagram.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions spec/factories/application_forms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# submitted_at :datetime
# teaching_authority_provides_written_statement :boolean default(FALSE), not null
# teaching_qualification_part_of_degree :boolean
# trs_match :jsonb
# withdrawn_at :datetime
# work_history_status :string default("not_started"), not null
# working_days_since_submission :integer
Expand Down
2 changes: 1 addition & 1 deletion spec/forms/support_interface/country_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
it "sets has_regions to true" do
expect(subject).to have_attributes(
has_regions: true,
region_names: "Madrid\nBarcelona",
region_names: country.reload.regions.map(&:name).join("\n"),
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/jobs/update_trs_match_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
end

it "does not update the application form if no results are returned" do
expect { perform }.to change(application_form, :dqt_match).to(
expect { perform }.to change(application_form, :trs_match).to(
{ "teachers" => [] },
)
end
Expand All @@ -51,7 +51,7 @@
application_form:,
).and_return(results)

expect { perform }.to change(application_form, :dqt_match).to(
expect { perform }.to change(application_form, :trs_match).to(
{ "teachers" => results },
)
end
Expand Down
1 change: 1 addition & 0 deletions spec/models/application_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
# submitted_at :datetime
# teaching_authority_provides_written_statement :boolean default(FALSE), not null
# teaching_qualification_part_of_degree :boolean
# trs_match :jsonb
# withdrawn_at :datetime
# work_history_status :string default("not_started"), not null
# working_days_since_submission :integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def and_i_see_the_warning_of_an_existing_record_in_dqt
end

def and_the_applicant_matches_a_record_in_dqt
application_form.update!(dqt_match:)
application_form.update!(trs_match:)
end

def application_form
Expand All @@ -64,7 +64,7 @@ def application_form

delegate :reference, to: :application_form

def dqt_match
def trs_match
{
"first_name" => "John",
"last_name" => "Smith",
Expand Down

0 comments on commit 2d36619

Please sign in to comment.