diff --git a/app/jobs/update_trs_match_job.rb b/app/jobs/update_trs_match_job.rb index e73d6f81e..ef0145943 100644 --- a/app/jobs/update_trs_match_job.rb +++ b/app/jobs/update_trs_match_job.rb @@ -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 diff --git a/app/models/application_form.rb b/app/models/application_form.rb index 66d458bb5..5ced863d8 100644 --- a/app/models/application_form.rb +++ b/app/models/application_form.rb @@ -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 diff --git a/app/view_objects/assessor_interface/application_forms_show_view_object.rb b/app/view_objects/assessor_interface/application_forms_show_view_object.rb index 7f004da30..8fc780d94 100644 --- a/app/view_objects/assessor_interface/application_forms_show_view_object.rb +++ b/app/view_objects/assessor_interface/application_forms_show_view_object.rb @@ -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 @@ -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, diff --git a/config/analytics.yml b/config/analytics.yml index 38de10194..e99f76165 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -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 diff --git a/config/analytics_hidden_pii.yml b/config/analytics_hidden_pii.yml index 5aa229ed6..a50bc43b4 100644 --- a/config/analytics_hidden_pii.yml +++ b/config/analytics_hidden_pii.yml @@ -7,6 +7,7 @@ - given_names - registration_number - dqt_match + - trs_match :assessments: - recommendation_assessor_note :further_information_request_items: diff --git a/db/migrate/20241122110920_add_trs_match_column_to_application_forms.rb b/db/migrate/20241122110920_add_trs_match_column_to_application_forms.rb new file mode 100644 index 000000000..1a292917a --- /dev/null +++ b/db/migrate/20241122110920_add_trs_match_column_to_application_forms.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index cb7b6913f..7af52d778 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_10_29_152315) do +ActiveRecord::Schema[7.2].define(version: 2024_11_22_110920) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -98,6 +98,7 @@ t.boolean "qualification_changed_work_history_duration", default: false, null: false t.boolean "teaching_qualification_part_of_degree" t.boolean "subject_limited", default: false, null: false + t.jsonb "trs_match", default: {} t.index ["action_required_by"], name: "index_application_forms_on_action_required_by" t.index ["assessor_id"], name: "index_application_forms_on_assessor_id" t.index ["english_language_provider_id"], name: "index_application_forms_on_english_language_provider_id" diff --git a/db/scripts/sanitise.sql b/db/scripts/sanitise.sql index 9cdda1f14..0e60b5fa9 100644 --- a/db/scripts/sanitise.sql +++ b/db/scripts/sanitise.sql @@ -14,6 +14,7 @@ SET alternative_given_names = '', alternative_family_name = '', dqt_match = '{}', + trs_match = '{}', registration_number = ''; -- AssessmentSectionFailureReason diff --git a/docs/diagram.pdf b/docs/diagram.pdf index c150c9d90..b6f8927c2 100644 Binary files a/docs/diagram.pdf and b/docs/diagram.pdf differ diff --git a/spec/factories/application_forms.rb b/spec/factories/application_forms.rb index 7d0847d1a..0fe73e0a2 100644 --- a/spec/factories/application_forms.rb +++ b/spec/factories/application_forms.rb @@ -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 diff --git a/spec/forms/support_interface/country_form_spec.rb b/spec/forms/support_interface/country_form_spec.rb index ba2df1f68..9940075f7 100644 --- a/spec/forms/support_interface/country_form_spec.rb +++ b/spec/forms/support_interface/country_form_spec.rb @@ -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 diff --git a/spec/jobs/update_trs_match_job_spec.rb b/spec/jobs/update_trs_match_job_spec.rb index 44f05fab9..ac872f0d1 100644 --- a/spec/jobs/update_trs_match_job_spec.rb +++ b/spec/jobs/update_trs_match_job_spec.rb @@ -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 @@ -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 diff --git a/spec/models/application_form_spec.rb b/spec/models/application_form_spec.rb index 6e5a6ff5e..2afbfb5db 100644 --- a/spec/models/application_form_spec.rb +++ b/spec/models/application_form_spec.rb @@ -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 diff --git a/spec/system/assessor_interface/duplicate_applicant_application_form_spec.rb b/spec/system/assessor_interface/duplicate_applicant_application_form_spec.rb index 409d4f5a5..f8b4ff709 100644 --- a/spec/system/assessor_interface/duplicate_applicant_application_form_spec.rb +++ b/spec/system/assessor_interface/duplicate_applicant_application_form_spec.rb @@ -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 @@ -64,7 +64,7 @@ def application_form delegate :reference, to: :application_form - def dqt_match + def trs_match { "first_name" => "John", "last_name" => "Smith",