From 0d7f5ce99ef3eb71fbb87d5b7dfce11ddddfa16b Mon Sep 17 00:00:00 2001 From: Raul Gracia Date: Thu, 5 Oct 2023 15:35:10 +0100 Subject: [PATCH] Rename Rejection Details column to Comments (#282) --- app/controllers/system_admin/applicants_controller.rb | 2 +- app/models/application_progress.rb | 2 +- app/models/reports/qa_report.rb | 2 +- app/views/system_admin/applicants/edit.html.erb | 2 +- app/views/system_admin/applicants/show.html.erb | 4 ++-- .../20231002115920_rename_rejection_details_to_comments.rb | 5 +++++ db/schema.rb | 4 ++-- spec/factories/application_progresses.rb | 2 +- spec/features/admin_console/update_progress_spec.rb | 2 +- spec/models/application_progress_spec.rb | 2 +- spec/models/reports/qa_report_spec.rb | 5 ++--- 11 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20231002115920_rename_rejection_details_to_comments.rb diff --git a/app/controllers/system_admin/applicants_controller.rb b/app/controllers/system_admin/applicants_controller.rb index 06bbca36..ac7da700 100644 --- a/app/controllers/system_admin/applicants_controller.rb +++ b/app/controllers/system_admin/applicants_controller.rb @@ -53,7 +53,7 @@ def applicant_params :payment_confirmation_completed_at, :rejection_completed_at, :rejection_reason, - :rejection_details, + :comments, ) end diff --git a/app/models/application_progress.rb b/app/models/application_progress.rb index 3a42614d..9e8dc4ff 100644 --- a/app/models/application_progress.rb +++ b/app/models/application_progress.rb @@ -6,11 +6,11 @@ # # id :bigint not null, primary key # banking_approval_completed_at :date +# comments :text # home_office_checks_completed_at :date # initial_checks_completed_at :date # payment_confirmation_completed_at :date # rejection_completed_at :date -# rejection_details :text # rejection_reason :integer # school_checks_completed_at :date # school_investigation_required :boolean default(FALSE), not null diff --git a/app/models/reports/qa_report.rb b/app/models/reports/qa_report.rb index 9f6871cb..af3f0db5 100644 --- a/app/models/reports/qa_report.rb +++ b/app/models/reports/qa_report.rb @@ -60,7 +60,7 @@ def rejection_rows(app) [ app.application_progress.rejection_reason&.humanize, - app.application_progress.rejection_details, + app.application_progress.comments, ] end diff --git a/app/views/system_admin/applicants/edit.html.erb b/app/views/system_admin/applicants/edit.html.erb index a9abb2a3..3cbb9e04 100644 --- a/app/views/system_admin/applicants/edit.html.erb +++ b/app/views/system_admin/applicants/edit.html.erb @@ -32,7 +32,7 @@ <%= f.govuk_date_field :payment_confirmation_completed_at, legend: { text: "Payment Confirmation (payslip)", size: "s" } %> <%= f.govuk_date_field :rejection_completed_at, legend: { text: "Rejection Date", size: "s" } %> <%= f.govuk_select :rejection_reason, rejection_reasons, label: { text: "Rejection Reason" } %> - <%= f.govuk_text_area :rejection_details, label: { text: 'Rejection Details' }, rows: 3 %> + <%= f.govuk_text_area :comments, label: { text: 'Comments' }, rows: 3 %> <%= f.govuk_submit("Update") %> <% end %> diff --git a/app/views/system_admin/applicants/show.html.erb b/app/views/system_admin/applicants/show.html.erb index e3b8fa6e..a2efeb7f 100644 --- a/app/views/system_admin/applicants/show.html.erb +++ b/app/views/system_admin/applicants/show.html.erb @@ -58,8 +58,8 @@ row.with_value(text: @progress.rejection_reason&.humanize ) end summary_list.with_row do |row| - row.with_key(text: 'Rejection Details') - row.with_value(text: @progress.rejection_details ) + row.with_key(text: 'Comments') + row.with_value(text: @progress.comments ) end end end %> diff --git a/db/migrate/20231002115920_rename_rejection_details_to_comments.rb b/db/migrate/20231002115920_rename_rejection_details_to_comments.rb new file mode 100644 index 00000000..a0294f6e --- /dev/null +++ b/db/migrate/20231002115920_rename_rejection_details_to_comments.rb @@ -0,0 +1,5 @@ +class RenameRejectionDetailsToComments < ActiveRecord::Migration[7.0] + def change + rename_column :application_progresses, :rejection_details, :comments + end +end diff --git a/db/schema.rb b/db/schema.rb index a9313f30..a17533e8 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.0].define(version: 2023_09_27_092305) do +ActiveRecord::Schema[7.0].define(version: 2023_10_02_115920) do # These are extensions that must be enabled in order to support this database enable_extension "citext" enable_extension "plpgsql" @@ -64,7 +64,7 @@ t.date "rejection_completed_at" t.date "payment_confirmation_completed_at" t.date "banking_approval_completed_at" - t.text "rejection_details" + t.text "comments" t.integer "status", default: 0 t.integer "rejection_reason" end diff --git a/spec/factories/application_progresses.rb b/spec/factories/application_progresses.rb index 898bc3c1..a7bf61f1 100644 --- a/spec/factories/application_progresses.rb +++ b/spec/factories/application_progresses.rb @@ -4,11 +4,11 @@ # # id :bigint not null, primary key # banking_approval_completed_at :date +# comments :text # home_office_checks_completed_at :date # initial_checks_completed_at :date # payment_confirmation_completed_at :date # rejection_completed_at :date -# rejection_details :text # rejection_reason :integer # school_checks_completed_at :date # school_investigation_required :boolean default(FALSE), not null diff --git a/spec/features/admin_console/update_progress_spec.rb b/spec/features/admin_console/update_progress_spec.rb index 009bc762..4a2b8c40 100644 --- a/spec/features/admin_console/update_progress_spec.rb +++ b/spec/features/admin_console/update_progress_spec.rb @@ -93,7 +93,7 @@ def when_i_submit_a_rejection_with_reason def when_i_submit_a_rejection_with_reason_and_details fill_in_rejection_date select "Suspected fraud", from: "application_progress[rejection_reason]" - fill_in "application_progress[rejection_details]", with: "suspected_fraud" + fill_in "application_progress[comments]", with: "I suspected fraud on this application" click_button "Update" end diff --git a/spec/models/application_progress_spec.rb b/spec/models/application_progress_spec.rb index ab5bf99e..2be435eb 100644 --- a/spec/models/application_progress_spec.rb +++ b/spec/models/application_progress_spec.rb @@ -4,11 +4,11 @@ # # id :bigint not null, primary key # banking_approval_completed_at :date +# comments :text # home_office_checks_completed_at :date # initial_checks_completed_at :date # payment_confirmation_completed_at :date # rejection_completed_at :date -# rejection_details :text # rejection_reason :integer # school_checks_completed_at :date # school_investigation_required :boolean default(FALSE), not null diff --git a/spec/models/reports/qa_report_spec.rb b/spec/models/reports/qa_report_spec.rb index 1fd0a83f..e246c71b 100644 --- a/spec/models/reports/qa_report_spec.rb +++ b/spec/models/reports/qa_report_spec.rb @@ -48,8 +48,7 @@ module Reports let(:status) { "rejected" } it "returns the data including rejection reasons in CSV format" do - application = create(:application, application_progress: build(:application_progress, rejection_completed_at: Time.zone.now, status: :rejected, rejection_reason: :request_to_re_submit, rejection_details: "Some details")) - + application = create(:application, application_progress: build(:application_progress, rejection_completed_at: Time.zone.now, status: :rejected, rejection_reason: :request_to_re_submit, comments: "Some details")) expect(report.csv).to include([ application.urn, application.applicant.full_name, @@ -66,7 +65,7 @@ module Reports application.visa_type, application.date_of_entry.strftime("%d/%m/%Y"), application.application_progress.rejection_reason&.humanize, - application.application_progress.rejection_details, + application.application_progress.comments, ].join(",")) end end