From 4517b8d1781cbabd6f9b8cf4dfff517eebbfef9e Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Fri, 15 Aug 2025 11:47:26 +0100 Subject: [PATCH 01/11] Update FI titles for applicants --- .../further_information_request_view_object.rb | 2 +- config/locales/teacher_interface.en.yml | 2 +- spec/system/teacher_interface/further_information_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/view_objects/teacher_interface/further_information_request_view_object.rb b/app/view_objects/teacher_interface/further_information_request_view_object.rb index dcf2c1127..27a2d85bf 100644 --- a/app/view_objects/teacher_interface/further_information_request_view_object.rb +++ b/app/view_objects/teacher_interface/further_information_request_view_object.rb @@ -104,7 +104,7 @@ def item_name(item) "teacher_interface.further_information_request.show.failure_reason.#{item.failure_reason_key}", ) when "work_history_contact" - "Add work history details" + "Update reference details for #{item.work_history.school_name}" when "document" if item.document.document_type == "passport" "Upload your #{I18n.t("document.document_type.#{item.document.document_type}")}" diff --git a/config/locales/teacher_interface.en.yml b/config/locales/teacher_interface.en.yml index de60b9a14..fada93ac7 100644 --- a/config/locales/teacher_interface.en.yml +++ b/config/locales/teacher_interface.en.yml @@ -100,7 +100,7 @@ en: check: Check your answers before submitting failure_reason: age_range: Tell us more about the age range you can teach - applicant_already_dqt: Additional personal information + applicant_already_dqt: Provide additional personal information english_language_unverifiable_reference_number: Tell us more about your English language proficiency qualifications_dont_match_other_details: Tell us more about your qualifications qualifications_dont_match_subjects: Tell us more about the subjects you can teach diff --git a/spec/system/teacher_interface/further_information_spec.rb b/spec/system/teacher_interface/further_information_spec.rb index 3a5d9558a..fbadfd2eb 100644 --- a/spec/system/teacher_interface/further_information_spec.rb +++ b/spec/system/teacher_interface/further_information_spec.rb @@ -222,7 +222,7 @@ def and_i_see_the_check_your_answers_items expect(rows.first.key.text).to eq( "Tell us more about the subjects you can teach", ) - expect(rows.second.key.text).to eq("Add work history details") + expect(rows.second.key.text).to eq("Update reference details for #{application_form.work_histories.first.school_name}") expect(rows.last.key.text).to eq("Upload your identity document") end @@ -309,7 +309,7 @@ def text_check_answers_item def work_history_task_list_item teacher_further_information_requested_page.task_list.find_item( - "Add work history details", + "Update reference details for #{application_form.work_histories.first.school_name}", ) end From dc522e0484a5407953521be89f5bb60d896d4ead Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Mon, 18 Aug 2025 11:04:55 +0100 Subject: [PATCH 02/11] Update heading and warning text for FI applicant show page --- .../further_information_requests/show.html.erb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/views/teacher_interface/further_information_requests/show.html.erb b/app/views/teacher_interface/further_information_requests/show.html.erb index 67f20218e..da87d78d5 100644 --- a/app/views/teacher_interface/further_information_requests/show.html.erb +++ b/app/views/teacher_interface/further_information_requests/show.html.erb @@ -1,9 +1,8 @@ -<% content_for :page_title, "Apply for qualified teacher status (QTS)" %> +<% content_for :page_title, "Review the information we’ve asked for" %> <% content_for :back_link_url, back_history_path(default: teacher_interface_application_form_path) %> -

Apply for qualified teacher status (QTS)

- -

Further information requested

+Your application +

Review the information we’ve asked for

<%= govuk_task_list do |task_list| @view_object.task_list_items.each do |item| @@ -14,6 +13,10 @@ end end %> +<% if @view_object.further_information_request.third_request? %> + <%= govuk_warning_text(text: "This is your final opportunity to provide the required information. You must submit this information by 11:59pm (#{@view_object.further_information_request.expires_at.in_time_zone('Europe/London').strftime('%Z')}) on #{@view_object.further_information_request.expires_at.to_date.to_fs} or your application will be declined.") %> +<% end %> + <% if FeatureFlags::FeatureFlag.active?(:gov_one_applicant_login) %> <%= govuk_button_link_to t("teacher_interface.application_forms.show.draft.save"), logout_uri, secondary: true %> <% else %> From b87591ec53161fa7ae1c1cc220d675ee13460269 Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Tue, 19 Aug 2025 09:59:10 +0100 Subject: [PATCH 03/11] Display FI request items to applicants in group of categories on the sections they filled out when they went through their application --- ...er_information_request_items_controller.rb | 6 + ...er_information_request_item_view_object.rb | 70 +++++++++++ ...further_information_request_view_object.rb | 118 +++++++++++++----- .../_inner_form.html.erb | 19 ++- .../show.html.erb | 17 +-- config/locales/teacher_interface.en.yml | 8 ++ .../further_information_spec.rb | 4 +- ...formation_request_item_view_object_spec.rb | 91 ++++++++++++++ ...er_information_request_view_object_spec.rb | 87 +++++++++---- 9 files changed, 350 insertions(+), 70 deletions(-) create mode 100644 app/view_objects/teacher_interface/further_information_request_item_view_object.rb create mode 100644 spec/view_objects/teacher_interface/further_information_request_item_view_object_spec.rb diff --git a/app/controllers/teacher_interface/further_information_request_items_controller.rb b/app/controllers/teacher_interface/further_information_request_items_controller.rb index 710db9bc9..fe6a27637 100644 --- a/app/controllers/teacher_interface/further_information_request_items_controller.rb +++ b/app/controllers/teacher_interface/further_information_request_items_controller.rb @@ -21,6 +21,12 @@ def update def load_further_information_request_and_item @further_information_request_item = further_information_request_item @further_information_request = further_information_request + @view_object = view_object + end + + def view_object + @view_object ||= + FurtherInformationRequestItemViewObject.new(current_teacher:, params:) end def edit_text diff --git a/app/view_objects/teacher_interface/further_information_request_item_view_object.rb b/app/view_objects/teacher_interface/further_information_request_item_view_object.rb new file mode 100644 index 000000000..020c5f4b6 --- /dev/null +++ b/app/view_objects/teacher_interface/further_information_request_item_view_object.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module TeacherInterface + class FurtherInformationRequestItemViewObject + def initialize(current_teacher:, params:) + @current_teacher = current_teacher + @params = params + end + + def further_information_request_item + @further_information_request_item ||= + FurtherInformationRequestItem + .joins(further_information_request: :assessment) + .where( + further_information_request: { + received_at: nil, + assessments: { + application_form:, + }, + }, + ) + .find(params[:id]) + end + + def item_name + case further_information_request_item.information_type + when "text" + I18n.t( + further_information_request_item.failure_reason_key, + scope: %i[ + teacher_interface + further_information_request + show + failure_reason + ], + ) + when "work_history_contact" + "Update reference details for #{further_information_request_item.work_history.school_name}" + when "document" + if further_information_request_item.document.document_type == "passport" + "Upload your #{I18n.t("document.document_type.#{further_information_request_item.document.document_type}")}" + else + "Upload your " \ + "#{I18n.t("document.document_type.#{further_information_request_item.document.document_type}")} document" + end + end + end + + def item_description + I18n.t( + further_information_request_item.failure_reason_key, + scope: %i[ + teacher_interface + application_forms + show + declined + failure_reasons + ], + ).gsub(".", "") + end + + def application_form + @application_form ||= current_teacher.application_form + end + + private + + attr_reader :current_teacher, :params + end +end diff --git a/app/view_objects/teacher_interface/further_information_request_view_object.rb b/app/view_objects/teacher_interface/further_information_request_view_object.rb index 27a2d85bf..848ab8d1b 100644 --- a/app/view_objects/teacher_interface/further_information_request_view_object.rb +++ b/app/view_objects/teacher_interface/further_information_request_view_object.rb @@ -15,41 +15,56 @@ def further_information_request .find(params[:id]) end - def task_list_items - items = - further_information_request - .items - .order(:created_at) - .map do |item| - { - title: item_name(item), - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - item, - ], - status: item.status, - } - end - - items << { - title: - I18n.t("teacher_interface.further_information_request.show.check"), - href: - if can_check_answers? - [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - ] - end, - status: can_check_answers? ? "not_started" : "cannot_start", + def grouped_task_list_items + grouped_items = + items_by_assessment_section.map do |assessment_section, items| + { + heading: + I18n.t( + assessment_section.key, + scope: %i[ + teacher_interface + further_information_request + show + section + ], + ), + items: task_list_items(items), + } + end + + grouped_items << { + heading: + I18n.t( + :check_your_answers, + scope: %i[ + teacher_interface + further_information_request + show + section + ], + ), + items: [ + { + title: + I18n.t( + "teacher_interface.further_information_request.show.check", + ), + href: + if can_check_answers? + [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + ] + end, + status: can_check_answers? ? "not_started" : "cannot_start", + }, + ], } - items + grouped_items end def can_check_answers? @@ -85,6 +100,30 @@ def application_form attr_reader :current_teacher, :params + def items_by_assessment_section + @items_by_assessment_section ||= + FurtherInformationRequestItemsByAssessmentSection.call( + further_information_request:, + ) + end + + def task_list_items(items) + items.map do |item| + { + title: item_name(item), + description: item_description(item), + href: [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + item, + ], + status: item.status, + } + end + end + def item_value(item) if item.text? item.response @@ -113,5 +152,18 @@ def item_name(item) end end end + + def item_description(item) + I18n.t( + item.failure_reason_key, + scope: %i[ + teacher_interface + application_forms + show + declined + failure_reasons + ], + ).gsub(".", "") + end end end diff --git a/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb b/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb index 48b1324f0..ae94aee1d 100644 --- a/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb +++ b/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb @@ -2,9 +2,22 @@ <%= f.govuk_error_summary %> <% end %> -

Further information required

- -

<%= I18n.t("teacher_interface.application_forms.show.declined.failure_reasons.#{@further_information_request_item.failure_reason_key}") %>

+<% + section_name = @further_information_request_item + .further_information_request + .assessment + .sections + .includes(:selected_failure_reasons) + .find_by(selected_failure_reasons: { key: @further_information_request_item.failure_reason_key }) + .key +%> +<%= I18n.t("teacher_interface.further_information_request.show.section.#{section_name}") %> +<% if @further_information_request_item.document? %> +

Review note from assessor

+<% else %> +

<%= @view_object.item_name %>

+<% end %> +

<%= @view_object.item_description %>

<%= govuk_inset_text do %> <%= simple_format @further_information_request_item.failure_reason_assessor_feedback %> diff --git a/app/views/teacher_interface/further_information_requests/show.html.erb b/app/views/teacher_interface/further_information_requests/show.html.erb index da87d78d5..c249c8017 100644 --- a/app/views/teacher_interface/further_information_requests/show.html.erb +++ b/app/views/teacher_interface/further_information_requests/show.html.erb @@ -4,14 +4,17 @@ Your application

Review the information we’ve asked for

-<%= govuk_task_list do |task_list| - @view_object.task_list_items.each do |item| - task_list.with_item do |row| - row.with_title(text: item[:title], href: item[:href]) - row.with_status(text: render(StatusTag::Component.new(item[:status])), classes: "app-white-space-nowrap") +<% @view_object.grouped_task_list_items.each do |grouped_task_list_item| %> +

<%= grouped_task_list_item[:heading] %>

+ <%= govuk_task_list do |task_list| + grouped_task_list_item[:items].each do |item| + task_list.with_item do |row| + row.with_title(text: item[:title], hint: item[:description], href: item[:href]) + row.with_status(text: render(StatusTag::Component.new(item[:status])), classes: "app-white-space-nowrap") + end end - end -end %> + end %> +<% end %> <% if @view_object.further_information_request.third_request? %> <%= govuk_warning_text(text: "This is your final opportunity to provide the required information. You must submit this information by 11:59pm (#{@view_object.further_information_request.expires_at.in_time_zone('Europe/London').strftime('%Z')}) on #{@view_object.further_information_request.expires_at.to_date.to_fs} or your application will be declined.") %> diff --git a/config/locales/teacher_interface.en.yml b/config/locales/teacher_interface.en.yml index fada93ac7..fbdfa503c 100644 --- a/config/locales/teacher_interface.en.yml +++ b/config/locales/teacher_interface.en.yml @@ -111,6 +111,14 @@ en: work_history_break: Tell us more about your work history work_history_information: Tell us more about your work history written_statement_mismatch: Tell us more about your written statement + section: + check_your_answers: Check your answers + personal_information: About you + qualifications: Your qualifications + age_range_subjects: The age range and subjects you can teach + english_language_proficiency: Your English language proficiency + work_history: Your work history + professional_standing: Proof that you’re recognised as a teacher reference_requests: show: title: You’ve been asked to act as a reference diff --git a/spec/system/teacher_interface/further_information_spec.rb b/spec/system/teacher_interface/further_information_spec.rb index fbadfd2eb..cd1ba3db6 100644 --- a/spec/system/teacher_interface/further_information_spec.rb +++ b/spec/system/teacher_interface/further_information_spec.rb @@ -222,7 +222,9 @@ def and_i_see_the_check_your_answers_items expect(rows.first.key.text).to eq( "Tell us more about the subjects you can teach", ) - expect(rows.second.key.text).to eq("Update reference details for #{application_form.work_histories.first.school_name}") + expect(rows.second.key.text).to eq( + "Update reference details for #{application_form.work_histories.first.school_name}", + ) expect(rows.last.key.text).to eq("Upload your identity document") end diff --git a/spec/view_objects/teacher_interface/further_information_request_item_view_object_spec.rb b/spec/view_objects/teacher_interface/further_information_request_item_view_object_spec.rb new file mode 100644 index 000000000..2c6500b86 --- /dev/null +++ b/spec/view_objects/teacher_interface/further_information_request_item_view_object_spec.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe TeacherInterface::FurtherInformationRequestItemViewObject do + subject(:view_object) do + described_class.new( + current_teacher:, + params: ActionController::Parameters.new(params), + ) + end + + let(:current_teacher) { create(:teacher) } + let(:application_form) { create(:application_form, teacher: current_teacher) } + let(:further_information_request) do + create( + :further_information_request, + :requested, + assessment: create(:assessment, application_form:), + ) + end + + let(:params) do + { + id: further_information_request_item.id, + application_form_id: application_form.id, + } + end + + describe "#item_name" do + subject(:item_name) { view_object.item_name } + + context "when item is a text response" do + let(:further_information_request_item) do + create( + :further_information_request_item, + :with_text_response, + further_information_request:, + ) + end + + it { is_expected.to eq("Tell us more about the subjects you can teach") } + end + + context "when item is a document response" do + let(:further_information_request_item) do + create( + :further_information_request_item, + :with_document_response, + further_information_request:, + ) + end + + it { is_expected.to eq("Upload your identity document") } + end + + context "when item is a work history reference contact response" do + let(:further_information_request_item) do + create( + :further_information_request_item, + :with_work_history_contact_response, + further_information_request:, + ) + end + + it do + expect(subject).to eq( + "Update reference details for #{further_information_request_item.work_history.school_name}", + ) + end + end + end + + describe "#item_description" do + subject(:item_description) { view_object.item_description } + + let(:further_information_request_item) do + create( + :further_information_request_item, + :with_text_response, + further_information_request:, + ) + end + + it do + expect(subject).to eq( + "The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them", + ) + end + end +end diff --git a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb index 4ce48d90f..3d8d77273 100644 --- a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb +++ b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb @@ -26,8 +26,20 @@ } end - describe "#task_list_items" do - subject(:task_list_items) { view_object.task_list_items } + let(:personal_information_assessment_section) do + create :assessment_section, + :personal_information, + assessment: further_information_request.assessment + end + + let(:qualifications_assessment_section) do + create :assessment_section, + :qualifications, + assessment: further_information_request.assessment + end + + describe "#grouped_task_list_items" do + subject(:grouped_task_list_items) { view_object.grouped_task_list_items } let!(:text_item) do create( @@ -45,18 +57,33 @@ ) end + before do + create :selected_failure_reason, + assessment_section: personal_information_assessment_section, + key: text_item.failure_reason_key + + create :selected_failure_reason, + assessment_section: qualifications_assessment_section, + key: document_item.failure_reason_key + end + it do expect(subject).to include( { - title: "Tell us more about the subjects you can teach", - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - text_item, + heading: "About you", + items: [ + title: "Tell us more about the subjects you can teach", + description: + "The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them", + href: [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + text_item, + ], + status: "not_started", ], - status: "not_started", }, ) end @@ -64,24 +91,30 @@ it do expect(subject).to include( { - title: "Upload your identity document", - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - document_item, + heading: "Your qualifications", + items: [ + title: "Upload your identity document", + description: + "Your ID document is illegible or in a format we cannot accept", + href: [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + document_item, + ], + status: "not_started", ], - status: "not_started", }, ) end context "when items are incomplete" do - it "disables check your answers in task list" do - check_answers_item = task_list_items.last - expect(check_answers_item[:status]).to eq("cannot_start") - expect(check_answers_item[:href]).to be_nil + it "disables check your answers in task list group" do + check_answers_items = grouped_task_list_items.last + expect(check_answers_items[:heading]).to eq("Check your answers") + expect(check_answers_items[:items].first[:status]).to eq("cannot_start") + expect(check_answers_items[:items].first[:href]).to be_nil end end @@ -96,10 +129,12 @@ ) end - it "enables check your answers in task list" do - check_answers_item = task_list_items.last - expect(check_answers_item[:status]).to eq("not_started") - expect(check_answers_item[:href]).to be_present + it "enables check your answers in task list group" do + check_answers_items = grouped_task_list_items.last + + expect(check_answers_items[:heading]).to eq("Check your answers") + expect(check_answers_items[:items].first[:status]).to eq("not_started") + expect(check_answers_items[:items].first[:href]).to be_present end end end From 079b1051c355f3000c88e4948e4bd88cc31810be Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Tue, 19 Aug 2025 12:44:48 +0100 Subject: [PATCH 04/11] Check your answers before submitting page update for applicant FI This change includes grouping and providing more information about the FI responses by the applicant --- ...further_information_requests_controller.rb | 1 + ...further_information_request_view_object.rb | 75 ++++++----- .../edit.html.erb | 32 ++++- .../show.html.erb | 10 ++ ...er_information_request_view_object_spec.rb | 125 +++++------------- 5 files changed, 106 insertions(+), 137 deletions(-) diff --git a/app/controllers/teacher_interface/further_information_requests_controller.rb b/app/controllers/teacher_interface/further_information_requests_controller.rb index d148c59ce..fb2c2b47d 100644 --- a/app/controllers/teacher_interface/further_information_requests_controller.rb +++ b/app/controllers/teacher_interface/further_information_requests_controller.rb @@ -14,6 +14,7 @@ def show end def edit + render layout: "full_from_desktop" end def update diff --git a/app/view_objects/teacher_interface/further_information_request_view_object.rb b/app/view_objects/teacher_interface/further_information_request_view_object.rb index 848ab8d1b..f5b3eda0a 100644 --- a/app/view_objects/teacher_interface/further_information_request_view_object.rb +++ b/app/view_objects/teacher_interface/further_information_request_view_object.rb @@ -16,24 +16,25 @@ def further_information_request end def grouped_task_list_items - grouped_items = - items_by_assessment_section.map do |assessment_section, items| - { - heading: - I18n.t( - assessment_section.key, - scope: %i[ - teacher_interface - further_information_request - show - section - ], - ), - items: task_list_items(items), - } - end + items_by_assessment_section.map do |assessment_section, items| + { + heading: + I18n.t( + assessment_section.key, + scope: %i[ + teacher_interface + further_information_request + show + section + ], + ), + items: task_list_items(items), + } + end + end - grouped_items << { + def check_your_answers_task_group + { heading: I18n.t( :check_your_answers, @@ -63,8 +64,6 @@ def grouped_task_list_items }, ], } - - grouped_items end def can_check_answers? @@ -73,25 +72,6 @@ def can_check_answers? alias_method :can_submit?, :can_check_answers? - def check_your_answers_fields - further_information_request - .items - .order(:created_at) - .each_with_object({}) do |item, memo| - memo[item.id] = { - title: item_name(item), - value: item_value(item), - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - item, - ], - } - end - end - def application_form @application_form ||= current_teacher.application_form end @@ -112,6 +92,9 @@ def task_list_items(items) { title: item_name(item), description: item_description(item), + value_title: item_value_title(item), + value: item_value(item), + assessor_note: item.failure_reason_assessor_feedback, href: [ :edit, :teacher_interface, @@ -124,6 +107,22 @@ def task_list_items(items) end end + def item_value_title(item) + if item.text? + "Your response" + elsif item.document? + if item.document.document_type == "passport" + I18n.t( + "document.document_type.#{item.document.document_type}", + ).capitalize + else + "#{I18n.t("document.document_type.#{item.document.document_type}").capitalize} documents" + end + elsif item.work_history_contact? + "Reference details" + end + end + def item_value(item) if item.text? item.response diff --git a/app/views/teacher_interface/further_information_requests/edit.html.erb b/app/views/teacher_interface/further_information_requests/edit.html.erb index 6e745c986..611aec65e 100644 --- a/app/views/teacher_interface/further_information_requests/edit.html.erb +++ b/app/views/teacher_interface/further_information_requests/edit.html.erb @@ -3,14 +3,34 @@

Check your answers before submitting

-<%= render(CheckYourAnswersSummary::Component.new( - id: "check-your-answers", - model: @view_object.further_information_request, - title: t(".check_your_answers"), - fields: @view_object.check_your_answers_fields -)) %> +<% @view_object.grouped_task_list_items.each do |grouped_task_list_item| %> +

<%= grouped_task_list_item[:heading] %>

+ <% grouped_task_list_item[:items].each do |item| %> + <%= govuk_summary_card(title: item[:title] ) do |card| + card.with_summary_list do |summary_list| + summary_list.with_row do |row| + row.with_key { item[:value_title] } + row.with_value { item[:value] } + row.with_action( + href: item[:href], + visually_hidden_text: item[:title].downcase + ) + end + summary_list.with_row do |row| + row.with_key { "Note from assessor" } + row.with_value do + govuk_details(summary_text: "View note", text: item[:assessor_note]) + end + end + end + end %> + <% end %> +<% end %> <% if @view_object.can_submit? %> +

How we handle your data

+

You can read about the data we collect from you, how we use it and how it’s stored, in our <%= govuk_link_to "privacy policy", "https://www.gov.uk/government/publications/privacy-information-education-providers-workforce-including-teachers/5a254207-a566-44f7-ac77-6ba59fd26e04#using-your-data-when-you-use-the-apply-for-qualified-teacher-status-qts-in-england-service" %>.

+

Submitting your further information

By selecting the ‘Submit your response’ button you confirm that, to the best of your knowledge, the details you’ve provided are correct.

You will not be able to change your response, add new documents or delete anything once you submit it.

diff --git a/app/views/teacher_interface/further_information_requests/show.html.erb b/app/views/teacher_interface/further_information_requests/show.html.erb index c249c8017..0d21951b0 100644 --- a/app/views/teacher_interface/further_information_requests/show.html.erb +++ b/app/views/teacher_interface/further_information_requests/show.html.erb @@ -16,6 +16,16 @@ end %> <% end %> +

<%= @view_object.check_your_answers_task_group[:heading] %>

+<%= govuk_task_list do |task_list| + @view_object.check_your_answers_task_group[:items].each do |item| + task_list.with_item do |row| + row.with_title(text: item[:title], hint: item[:description], href: item[:href]) + row.with_status(text: render(StatusTag::Component.new(item[:status])), classes: "app-white-space-nowrap") + end + end +end %> + <% if @view_object.further_information_request.third_request? %> <%= govuk_warning_text(text: "This is your final opportunity to provide the required information. You must submit this information by 11:59pm (#{@view_object.further_information_request.expires_at.in_time_zone('Europe/London').strftime('%Z')}) on #{@view_object.further_information_request.expires_at.to_date.to_fs} or your application will be declined.") %> <% end %> diff --git a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb index 3d8d77273..e766616c9 100644 --- a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb +++ b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb @@ -83,6 +83,8 @@ text_item, ], status: "not_started", + value: nil, + value_title: "Your response", ], }, ) @@ -104,39 +106,12 @@ document_item, ], status: "not_started", + value: document_item.document, + value_title: "Identity documents", ], }, ) end - - context "when items are incomplete" do - it "disables check your answers in task list group" do - check_answers_items = grouped_task_list_items.last - expect(check_answers_items[:heading]).to eq("Check your answers") - expect(check_answers_items[:items].first[:status]).to eq("cannot_start") - expect(check_answers_items[:items].first[:href]).to be_nil - end - end - - context "when items are complete" do - before do - text_item.update!(response: "Response") - create( - :upload, - :clean, - document: document_item.document, - filename: "upload.pdf", - ) - end - - it "enables check your answers in task list group" do - check_answers_items = grouped_task_list_items.last - - expect(check_answers_items[:heading]).to eq("Check your answers") - expect(check_answers_items[:items].first[:status]).to eq("not_started") - expect(check_answers_items[:items].first[:href]).to be_present - end - end end describe "#can_check_answers?" do @@ -164,94 +139,58 @@ end end - describe "#check_your_answers_fields" do - subject(:check_your_answers_fields) do - view_object.check_your_answers_fields + describe "#check_your_answers_task_group" do + subject(:check_your_answers_task_group) do + view_object.check_your_answers_task_group end let!(:text_item) do create( :further_information_request_item, :with_text_response, - :completed, further_information_request:, ) end + let!(:document_item) do create( :further_information_request_item, :with_document_response, - :completed, further_information_request:, ) end - it do - expect(subject).to eq( - { - text_item.id => { - title: "Tell us more about the subjects you can teach", - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - text_item, - ], - value: text_item.response, - }, - document_item.id => { - title: "Upload your identity document", - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - document_item, - ], - value: document_item.document, - }, - }, - ) + context "when items are incomplete" do + it "disables check your answers in task list group" do + expect(check_your_answers_task_group[:heading]).to eq( + "Check your answers", + ) + expect(check_your_answers_task_group[:items].first[:status]).to eq( + "cannot_start", + ) + expect(check_your_answers_task_group[:items].first[:href]).to be_nil + end end - context "when the document item is passport" do - let!(:document_item) do + context "when items are complete" do + before do + text_item.update!(response: "Response") create( - :further_information_request_item, - :with_passport_document_response, - :completed, - further_information_request:, + :upload, + :clean, + document: document_item.document, + filename: "upload.pdf", ) end - it do - expect(subject).to eq( - { - text_item.id => { - title: "Tell us more about the subjects you can teach", - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - text_item, - ], - value: text_item.response, - }, - document_item.id => { - title: "Upload your passport", - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - document_item, - ], - value: document_item.document, - }, - }, + it "enables check your answers in task list group" do + expect(check_your_answers_task_group[:heading]).to eq( + "Check your answers", + ) + expect(check_your_answers_task_group[:items].first[:status]).to eq( + "not_started", ) + expect(check_your_answers_task_group[:items].first[:href]).to be_present end end end From 5fd4b3f9b450a8605dbb220db4072f5b068d36e2 Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Tue, 19 Aug 2025 13:31:00 +0100 Subject: [PATCH 05/11] ix tests --- .../autoload/page_objects/govuk_task_list.rb | 2 +- ...eck_further_information_request_answers.rb | 2 +- .../further_information_requested.rb | 2 +- .../further_information_spec.rb | 93 +++++++++---------- ...er_information_request_view_object_spec.rb | 2 + 5 files changed, 49 insertions(+), 52 deletions(-) diff --git a/spec/support/autoload/page_objects/govuk_task_list.rb b/spec/support/autoload/page_objects/govuk_task_list.rb index d18eaa997..fcab98a5c 100644 --- a/spec/support/autoload/page_objects/govuk_task_list.rb +++ b/spec/support/autoload/page_objects/govuk_task_list.rb @@ -10,7 +10,7 @@ class GovukTaskList < SitePrism::Section end def find_item(text) - items.find { |item| item.name_and_hint.text == text } + items.find { |item| item.name_and_hint.text.include?(text) } end def click_item(link_text) diff --git a/spec/support/autoload/page_objects/teacher_interface/check_further_information_request_answers.rb b/spec/support/autoload/page_objects/teacher_interface/check_further_information_request_answers.rb index c9c3467b1..864c38bd9 100644 --- a/spec/support/autoload/page_objects/teacher_interface/check_further_information_request_answers.rb +++ b/spec/support/autoload/page_objects/teacher_interface/check_further_information_request_answers.rb @@ -6,7 +6,7 @@ class CheckFurtherInformationRequestAnswers < SitePrism::Page set_url "/teacher/application/further_information_requests/{request_id}/edit" element :heading, ".govuk-heading-xl" - section :summary_list, GovukSummaryList, ".govuk-summary-list" + sections :summary_lists, GovukSummaryList, ".govuk-summary-list" element :submit_button, ".govuk-button" end end diff --git a/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb b/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb index b25f0f48b..8b42f473c 100644 --- a/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb +++ b/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb @@ -6,7 +6,7 @@ class FurtherInformationRequested < SitePrism::Page set_url "/teacher/application/further_information_requests/{request_id}" element :heading, ".govuk-heading-l" - section :task_list, GovukTaskList, ".govuk-task-list" + sections :task_lists, GovukTaskList, ".govuk-task-list" element :check_your_answers_button, ".govuk-button:not(.govuk-button--secondary)" diff --git a/spec/system/teacher_interface/further_information_spec.rb b/spec/system/teacher_interface/further_information_spec.rb index cd1ba3db6..a32cfe899 100644 --- a/spec/system/teacher_interface/further_information_spec.rb +++ b/spec/system/teacher_interface/further_information_spec.rb @@ -3,9 +3,20 @@ require "rails_helper" RSpec.describe "Teacher further information", type: :system do + let(:teacher) { create(:teacher) } + let!(:application_form) do + create( + :application_form, + :submitted, + :with_work_history, + statuses: %w[waiting_on_further_information], + teacher:, + ) + end + before do given_i_am_authorized_as_a_user(teacher) - given_there_is_an_application_form + given_there_is_an_application_form_with_assessment given_malware_scanning_is_enabled end @@ -106,10 +117,6 @@ end end - def given_there_is_an_application_form - application_form - end - def when_i_click_the_start_button teacher_further_information_requested_start_page.start_button.click end @@ -151,7 +158,7 @@ def when_i_click_the_text_task_list_item expect( teacher_further_information_required_page.failure_reason_heading.text, ).to eq( - "The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them.", + "The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them", ) end @@ -166,7 +173,7 @@ def when_i_click_the_document_task_list_item document_task_list_item.click expect( teacher_further_information_required_page.failure_reason_heading.text, - ).to eq("Your ID document is illegible or in a format we cannot accept.") + ).to eq("Your ID document is illegible or in a format we cannot accept") end def when_i_fill_in_the_response @@ -208,25 +215,21 @@ def when_i_click_the_check_your_answers_task_list_item end def check_your_answers_task_list_item - teacher_further_information_requested_page.task_list.find_item( + teacher_further_information_requested_page.task_lists.last.find_item( "Check your answers before submitting", ) end def and_i_see_the_check_your_answers_items - rows = - teacher_check_further_information_request_answers_page.summary_list.rows - - expect(rows.count).to eq(3) + lists = teacher_check_further_information_request_answers_page.summary_lists - expect(rows.first.key.text).to eq( - "Tell us more about the subjects you can teach", - ) - expect(rows.second.key.text).to eq( - "Update reference details for #{application_form.work_histories.first.school_name}", - ) + expect(lists.count).to eq(3) - expect(rows.last.key.text).to eq("Upload your identity document") + expect( + teacher_check_further_information_request_answers_page, + ).to have_content("Your response").and have_content( + "Reference details", + ).and have_content("Identity documents") end def when_i_click_the_text_check_your_answers_item @@ -246,7 +249,7 @@ def and_i_see_the_further_information_received_information "Further information successfully submitted", ) expect(teacher_submitted_application_page.panel.body.text).to eq( - "Your application reference number\n#{@application_form.reference}", + "Your application reference number\n#{application_form.reference}", ) end @@ -268,64 +271,56 @@ def and_i_receive_a_further_information_received_email expect(message.to).to include(application_form.teacher.email) end - def teacher - @teacher ||= create(:teacher) - end - - def application_form - @application_form ||= - begin - application_form = - create( - :application_form, - :submitted, - :with_work_history, - statuses: %w[waiting_on_further_information], - teacher:, - ) - create( - :assessment, - :with_further_information_request, - application_form:, - ) - application_form - end + def given_there_is_an_application_form_with_assessment + assessment = + create(:assessment, :with_further_information_request, application_form:) + assessment_section = + create(:assessment_section, :personal_information, assessment:) + assessment.further_information_requests.first.items.each do |item| + create( + :selected_failure_reason, + assessment_section: assessment_section, + key: item.failure_reason_key, + ) + end end def further_information_request - application_form.assessment.further_information_requests.first + application_form.reload.assessment.further_information_requests.first end def text_task_list_item - teacher_further_information_requested_page.task_list.find_item( + teacher_further_information_requested_page.task_lists.first.find_item( "Tell us more about the subjects you can teach", ) end def text_check_answers_item teacher_check_further_information_request_answers_page - .summary_list + .summary_lists + .second .rows .first end def work_history_task_list_item - teacher_further_information_requested_page.task_list.find_item( + teacher_further_information_requested_page.task_lists.first.find_item( "Update reference details for #{application_form.work_histories.first.school_name}", ) end def document_task_list_item - teacher_further_information_requested_page.task_list.find_item( + teacher_further_information_requested_page.task_lists.first.find_item( "Upload your identity document", ) end def document_check_answers_item teacher_check_further_information_request_answers_page - .summary_list + .summary_lists + .first .rows - .last + .first end def then_i_see_the_warning_text diff --git a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb index e766616c9..afd4b415b 100644 --- a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb +++ b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb @@ -85,6 +85,7 @@ status: "not_started", value: nil, value_title: "Your response", + assessor_note: text_item.failure_reason_assessor_feedback, ], }, ) @@ -108,6 +109,7 @@ status: "not_started", value: document_item.document, value_title: "Identity documents", + assessor_note: document_item.failure_reason_assessor_feedback, ], }, ) From eb3b62dcbd09a21382f15e83e8c3a0fe50591fa6 Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Wed, 20 Aug 2025 10:33:26 +0100 Subject: [PATCH 06/11] Sorting the FI items by reason title --- ...further_information_request_view_object.rb | 37 ++++++++++--------- .../further_information_spec.rb | 4 +- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/app/view_objects/teacher_interface/further_information_request_view_object.rb b/app/view_objects/teacher_interface/further_information_request_view_object.rb index f5b3eda0a..7333b8041 100644 --- a/app/view_objects/teacher_interface/further_information_request_view_object.rb +++ b/app/view_objects/teacher_interface/further_information_request_view_object.rb @@ -88,23 +88,26 @@ def items_by_assessment_section end def task_list_items(items) - items.map do |item| - { - title: item_name(item), - description: item_description(item), - value_title: item_value_title(item), - value: item_value(item), - assessor_note: item.failure_reason_assessor_feedback, - href: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - item, - ], - status: item.status, - } - end + list_items = + items.map do |item| + { + title: item_name(item), + description: item_description(item), + value_title: item_value_title(item), + value: item_value(item), + assessor_note: item.failure_reason_assessor_feedback, + href: [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + item, + ], + status: item.status, + } + end + + list_items.sort_by { |item| item[:title] } end def item_value_title(item) diff --git a/spec/system/teacher_interface/further_information_spec.rb b/spec/system/teacher_interface/further_information_spec.rb index a32cfe899..d139307b8 100644 --- a/spec/system/teacher_interface/further_information_spec.rb +++ b/spec/system/teacher_interface/further_information_spec.rb @@ -298,7 +298,7 @@ def text_task_list_item def text_check_answers_item teacher_check_further_information_request_answers_page .summary_lists - .second + .first .rows .first end @@ -318,7 +318,7 @@ def document_task_list_item def document_check_answers_item teacher_check_further_information_request_answers_page .summary_lists - .first + .third .rows .first end From 28ddf5a4dbe6f45128012147252fcc8af06debf5 Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Wed, 20 Aug 2025 15:12:57 +0100 Subject: [PATCH 07/11] Fix test following conflict --- spec/system/teacher_interface/further_information_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/teacher_interface/further_information_spec.rb b/spec/system/teacher_interface/further_information_spec.rb index d139307b8..9a5c59dde 100644 --- a/spec/system/teacher_interface/further_information_spec.rb +++ b/spec/system/teacher_interface/further_information_spec.rb @@ -166,7 +166,7 @@ def when_i_click_the_work_history_contact_task_list_item work_history_task_list_item.click expect( teacher_further_information_required_page.failure_reason_heading.text, - ).to eq("We could not verify one or more references you provided.") + ).to eq("We could not verify one or more references you provided") end def when_i_click_the_document_task_list_item From b6cab6e5a7205a6863fc2fb54fd341f53c2f4c9b Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Wed, 20 Aug 2025 15:34:16 +0100 Subject: [PATCH 08/11] Adding caption of FI check your answers page --- .../teacher_interface/further_information_requests/edit.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/teacher_interface/further_information_requests/edit.html.erb b/app/views/teacher_interface/further_information_requests/edit.html.erb index 611aec65e..ac9c39d31 100644 --- a/app/views/teacher_interface/further_information_requests/edit.html.erb +++ b/app/views/teacher_interface/further_information_requests/edit.html.erb @@ -1,6 +1,7 @@ <% content_for :page_title, "Check your answers before submitting" %> <% content_for :back_link_url, back_history_path(origin: true, default: teacher_interface_application_form_further_information_request_path(@view_object.further_information_request)) %> +Your application

Check your answers before submitting

<% @view_object.grouped_task_list_items.each do |grouped_task_list_item| %> From 632d0e865a47b309bd642d5b197aebcc4a173340 Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Wed, 20 Aug 2025 15:56:38 +0100 Subject: [PATCH 09/11] Update content for references FI values --- .../further_information_request_view_object.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/view_objects/teacher_interface/further_information_request_view_object.rb b/app/view_objects/teacher_interface/further_information_request_view_object.rb index 7333b8041..bd9d4af26 100644 --- a/app/view_objects/teacher_interface/further_information_request_view_object.rb +++ b/app/view_objects/teacher_interface/further_information_request_view_object.rb @@ -132,9 +132,9 @@ def item_value(item) elsif item.document? item.document elsif item.work_history_contact? - "Contact name: #{item.contact_name}
- Contact job: #{item.contact_job}
- Contact email: #{item.contact_email}".html_safe + "#{item.contact_name}
+ #{item.contact_job}
+ #{item.contact_email}".html_safe end end From 71ea3ab0ffe4e039b9a311c36c052a889dff698a Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Thu, 21 Aug 2025 11:16:32 +0100 Subject: [PATCH 10/11] Add full stop to reference update FI item description --- .../further_information_request_items/_inner_form.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb b/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb index ae94aee1d..3123573cf 100644 --- a/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb +++ b/app/views/teacher_interface/further_information_request_items/_inner_form.html.erb @@ -33,9 +33,7 @@ <% if @further_information_request_item.work_history_contact? %> <% work_history = @further_information_request_item.work_history %> -

Enter the contact details of a suitable referee who can verify your time spent working at <%= work_history.school_name %> from <%= work_history.start_date.to_fs(:month_and_year) %> <% if work_history.end_date.present? %> - to <%= work_history.end_date.to_fs(:month_and_year) %> - <% end %>

+

Enter the contact details of a suitable referee who can verify your time spent working at <%= work_history.school_name %> from <%= work_history.start_date.to_fs(:month_and_year) %><% if work_history.end_date.present? %> to <%= work_history.end_date.to_fs(:month_and_year) %><% end %>.

<%= f.govuk_text_field :contact_name, label: {text: "Contact’s name"} %> From 97c0c650302d258a645fdbedb77a217a0fee0f08 Mon Sep 17 00:00:00 2001 From: Hassan Mir Date: Wed, 27 Aug 2025 16:57:12 +0100 Subject: [PATCH 11/11] Fix uploads showing on check your answers FI --- .../further_information_requests/edit.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/teacher_interface/further_information_requests/edit.html.erb b/app/views/teacher_interface/further_information_requests/edit.html.erb index ac9c39d31..afa37cb6d 100644 --- a/app/views/teacher_interface/further_information_requests/edit.html.erb +++ b/app/views/teacher_interface/further_information_requests/edit.html.erb @@ -11,7 +11,18 @@ card.with_summary_list do |summary_list| summary_list.with_row do |row| row.with_key { item[:value_title] } - row.with_value { item[:value] } + row.with_value do + if item[:value].is_a?(Document) + tag.ul(class: "govuk-list") do + item[:value] + .uploads + .order(:created_at) + .each { |upload| concat(tag.li(upload_link_to(upload))) } + end + else + item[:value] + end + end row.with_action( href: item[:href], visually_hidden_text: item[:title].downcase