From 0d262bab514e8a6208b9e9b88e85ad33d895de48 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Mon, 25 Apr 2022 11:20:39 +0100 Subject: [PATCH] Remove submit lettings log button (#494) --- app/controllers/form_controller.rb | 2 -- app/models/form.rb | 5 ----- app/views/form/page.html.erb | 8 ++------ spec/features/form/validations_spec.rb | 11 +---------- 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 7fc4b87be..be15cc1b3 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -11,8 +11,6 @@ class FormController < ApplicationController session[:errors] = nil if is_referrer_check_answers? && !@case_log.form.next_page(@page, @case_log).to_s.include?("value_check") redirect_to(send("case_log_#{@case_log.form.subsection_for_page(@page).id}_check_answers_path", @case_log)) - elsif @case_log.form.is_last_question?(@page, @case_log.form.subsection_for_page(@page), @case_log) - redirect_to(case_logs_path) else redirect_path = @case_log.form.next_page_redirect_path(@page, @case_log) redirect_to(send(redirect_path, @case_log)) diff --git a/app/models/form.rb b/app/models/form.rb index 6beee8ec9..1a47ab287 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -140,11 +140,6 @@ class Form questions.select { |q| q.type == "numeric" } end - def is_last_question?(page, subsection, case_log) - subsection_ids = subsections.map(&:id) - subsection.id == subsection_ids[subsection_ids.length - 1] && next_page(page, case_log) == :check_answers - end - def previous_page(page_ids, page_index, case_log) prev_page = get_page(page_ids[page_index - 1]) return prev_page.id if prev_page.routed_to?(case_log) diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb index 37c6bc18e..074ca90b7 100644 --- a/app/views/form/page.html.erb +++ b/app/views/form/page.html.erb @@ -42,12 +42,8 @@ <% end %> <%= f.hidden_field :page, value: @page.id %> - <% if @case_log.form.is_last_question?(@page, @subsection, @case_log) %> - <%= f.govuk_submit "Submit lettings log", accesskey: "s" %> - <% else %> - <% if !@page.id.include?("value_check") %> - <%= f.govuk_submit "Save and continue", accesskey: "s" %> - <% end %> + <% if !@page.id.include?("value_check") %> + <%= f.govuk_submit "Save and continue", accesskey: "s" %> <% end %> diff --git a/spec/features/form/validations_spec.rb b/spec/features/form/validations_spec.rb index 75e7f3e99..2965046ef 100644 --- a/spec/features/form/validations_spec.rb +++ b/spec/features/form/validations_spec.rb @@ -154,18 +154,9 @@ RSpec.describe "validations" do context "when tenant has not seen the privacy notice" do it "shows a warning" do visit("/logs/#{completed_without_declaration.id}/declaration") - click_button("Submit lettings log") + click_button("Save and continue") expect(page).to have_content("You must show the DLUHC privacy notice to the tenant") end end - - context "when tenant has seen the privacy notice" do - it "the log can be submitted" do - completed_without_declaration.update!({ declaration: 1 }) - visit("/logs/#{completed_without_declaration.id}/declaration") - click_button("Submit lettings log") - expect(page).to have_current_path("/logs") - end - end end end