diff --git a/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb b/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb index 8f2503e232..ca2c458cf7 100644 --- a/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb +++ b/app/controllers/assessor_interface/assessment_recommendation_verify_controller.rb @@ -29,6 +29,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 @@ -146,7 +149,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, @@ -194,6 +197,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 @@ -256,5 +270,16 @@ def load_assessment_and_application_form @assessment = assessment @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 end end 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 356c118b8a..ecef5c958f 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], 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], 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], visually_hidden_text: "qualifications") end %> - <%= summary_list.with_row do |row| - row.with_key { "References" } - row.with_value do %> -Select submit to: