diff --git a/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb b/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb index 9c9fbd46e7..f4171a51a9 100644 --- a/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb +++ b/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb @@ -25,6 +25,9 @@ def edit application_form.qualifications.where(id: session[:qualification_ids]) @work_histories = application_form.work_histories.where(id: session[:work_history_ids]) + + @skip_professional_standing = skip_professional_standing? + @skip_references = skip_references? end def update @@ -140,7 +143,7 @@ def email_consent_letters def edit_professional_standing authorize %i[assessor_interface assessment_recommendation], :edit? - if application_form.teaching_authority_provides_written_statement + if skip_professional_standing? redirect_to [ :reference_requests, :assessor_interface, @@ -186,6 +189,17 @@ def update_professional_standing def edit_reference_requests authorize %i[assessor_interface assessment_recommendation], :edit? + if skip_references? + redirect_to [ + :edit, + :assessor_interface, + application_form, + assessment, + :assessment_recommendation_verify, + ] + return + end + @form = SelectWorkHistoriesForm.new(application_form:, session:) end @@ -247,6 +261,17 @@ def load_assessment_and_application_form @application_form = application_form end + def skip_professional_standing? + application_form.teaching_authority_provides_written_statement || + application_form.reduced_evidence_accepted || + !application_form.needs_work_history + end + + def skip_references? + application_form.reduced_evidence_accepted || + !application_form.needs_work_history + end + def back_to_summary_path(ordinary_path) if ActiveModel::Type::Boolean.new.cast(params[:back_to_summary]) [ diff --git a/app/services/verify_assessment.rb b/app/services/verify_assessment.rb index c743540578..07ccc09360 100644 --- a/app/services/verify_assessment.rb +++ b/app/services/verify_assessment.rb @@ -35,7 +35,9 @@ def call reference_requests end - send_reference_request_emails(reference_requests) + if reference_requests.present? + send_reference_request_emails(reference_requests) + end reference_requests end diff --git a/app/views/assessor_interface/assessment_recommendation_verify/edit.html.erb b/app/views/assessor_interface/assessment_recommendation_verify/edit.html.erb index dc4e2a92f5..250c561aaf 100644 --- a/app/views/assessor_interface/assessment_recommendation_verify/edit.html.erb +++ b/app/views/assessor_interface/assessment_recommendation_verify/edit.html.erb @@ -6,11 +6,13 @@
You have selected the following items for verification:
<%= govuk_summary_list do |summary_list| %> - <%= summary_list.with_row do |row| - row.with_key { "LoPS" } - row.with_value { @professional_standing ? region_teaching_authority_name(@application_form.region).upcase_first : "Not selected" } - row.with_action(text: "Change", href: professional_standing_assessor_interface_application_form_assessment_assessment_recommendation_verify_path(@application_form, @assessment, back_to_summary: "true"), visually_hidden_text: "LoPS") - end %> + <% unless @skip_professional_standing %> + <%= summary_list.with_row do |row| + row.with_key { "LoPS" } + row.with_value { @professional_standing ? region_teaching_authority_name(@application_form.region).upcase_first : "Not selected" } + row.with_action(text: "Change", href: professional_standing_assessor_interface_application_form_assessment_assessment_recommendation_verify_path(@application_form, @assessment, back_to_summary: "true"), visually_hidden_text: "LoPS") + end %> + <% end %> <%= summary_list.with_row do |row| row.with_key { "Qualifications" } @@ -28,17 +30,19 @@ row.with_action(text: "Change", href: verify_qualifications_assessor_interface_application_form_assessment_assessment_recommendation_verify_path(@application_form, @assessment, back_to_summary: "true"), visually_hidden_text: "qualifications") end %> - <%= summary_list.with_row do |row| - row.with_key { "References" } - row.with_value do %> -Select submit to: