diff --git a/app/models/form.rb b/app/models/form.rb index a233e7aee..f00507f50 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -79,7 +79,7 @@ class Form next_subsection_id_index = subsection_ids.index(subsection.id) + 1 next_subsection = get_subsection(subsection_ids[next_subsection_id_index]) - if next_subsection.id == "declaration" && case_log.status != "completed" + if subsection.id == "declaration" && case_log.status != "completed" next_subsection = get_subsection(subsection_ids[0]) end diff --git a/db/migrate/20220208101235_remove_gdpr_fields.rb b/db/migrate/20220208101235_remove_gdpr_fields.rb new file mode 100644 index 000000000..7272c483d --- /dev/null +++ b/db/migrate/20220208101235_remove_gdpr_fields.rb @@ -0,0 +1,15 @@ +class RemoveGdprFields < ActiveRecord::Migration[7.0] + def up + change_table :case_logs, bulk: true do |t| + t.remove :gdpr_declined + t.remove :gdpr_acceptance + end + end + + def down + change_table :case_logs, bulk: true do |t| + t.column :gdpr_declined, :string + t.column :gdpr_acceptance, :string + end + end +end diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb index cde579bf4..cadc0ec3e 100644 --- a/spec/features/form/check_answers_page_spec.rb +++ b/spec/features/form/check_answers_page_spec.rb @@ -209,7 +209,7 @@ RSpec.describe "Form Check Answers Page" do end it "they can click a button to cycle around to the next incomplete section" do - visit("/logs/#{cycle_sections_case_log.id}/local-authority/check-answers") + visit("/logs/#{cycle_sections_case_log.id}/declaration/check-answers") click_link("Save and go to next incomplete section") expect(page).to have_current_path("/logs/#{cycle_sections_case_log.id}/tenant-code") end diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index 6180aa8d4..93bca44c3 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form, type: :model do describe "next_incomplete_section_redirect_path" do let(:case_log) { FactoryBot.build(:case_log, :in_progress) } let(:subsection) { form.get_subsection("household_characteristics") } - let(:later_subsection) { form.get_subsection("setup") } + let(:later_subsection) { form.get_subsection("declaration") } context "when a user is on the check answers page for a subsection" do def answer_household_needs(case_log) @@ -111,6 +111,10 @@ RSpec.describe Form, type: :model do expect(form.next_incomplete_section_redirect_path(subsection, completed_case_log)).to eq("declaration") end + it "returns the next incomplete section by cycling back around if next subsections are completed" do + expect(form.next_incomplete_section_redirect_path(later_subsection, case_log)).to eq("armed-forces") + end + it "returns the declaration section if all sections are complete but the case log is in progress" do answer_household_needs(case_log) answer_tenancy_information(case_log)