From 007a222affe05208bb4e6c65db5686885879c4ac Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 8 Feb 2022 10:25:10 +0000 Subject: [PATCH] Remove gdpr fields --- app/models/bulk_upload.rb | 3 +- app/models/form/question.rb | 1 - config/forms/2021_2022.json | 50 +++---------------- db/schema.rb | 2 - spec/factories/case_log.rb | 3 -- spec/features/form/check_answers_page_spec.rb | 2 +- spec/features/form/tasklist_page_spec.rb | 4 +- spec/fixtures/complete_case_log.json | 2 - spec/fixtures/forms/2021_2022.json | 26 ---------- spec/fixtures/forms/2022_2023.json | 39 ++------------- spec/helpers/tasklist_helper_spec.rb | 4 +- spec/models/form/question_spec.rb | 12 ----- spec/models/form/subsection_spec.rb | 10 ---- spec/models/form_handler_spec.rb | 2 +- spec/models/form_spec.rb | 10 ---- spec/requests/case_logs_controller_spec.rb | 4 +- 16 files changed, 18 insertions(+), 156 deletions(-) diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index 66d24bf8d..aeccfc4cd 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -196,8 +196,7 @@ class BulkUpload intermediate_rent_product_name: row[131], # data_protection: row[132], sale_or_letting: "letting", - gdpr_acceptance: 1, - gdpr_declined: 0, + declaration: 1, } end diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 5282bae71..5ce963d9d 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -80,7 +80,6 @@ class Form::Question def completed?(case_log) # Special case as No is a valid answer but doesn't let you progress and use the service - return false if id == "gdpr_acceptance" && case_log[id] == "No" return answer_options.keys.any? { |key| case_log[key] == "Yes" } if type == "checkbox" case_log[id].present? || !case_log.respond_to?(id.to_sym) || has_inferred_display_value?(case_log) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 9bf27343d..9228e1eac 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -9,30 +9,6 @@ "setup": { "label": "Set up your lettings log", "pages": { - "gdpr_acceptance": { - "header": "", - "description": "", - "questions": { - "gdpr_acceptance": { - "check_answer_label": "Privacy notice seen", - "header": "Has the tenant or buyer seen the Department for Levelling Up, Housing and Communities (DLUHC) privacy notice?", - "hint_text": "You must show the privacy notice to the tenant or buyer before you can use this service.", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - } - } - }, - "gdpr_declined": { - "hide_subsection_label": true, - "header": "You cannot use this service", - "hint_text": "", - "description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.

Go to your logs", - "questions": {}, - "depends_on": [{ "gdpr_acceptance": "No" }] - }, "organisation_details": { "header": "Organisation details", "description": "", @@ -57,8 +33,7 @@ "1": "B" } } - }, - "depends_on": [{ "gdpr_acceptance": "Yes" }] + } }, "renewal": { "header": "", @@ -74,10 +49,7 @@ "0": "No" } } - }, - "depends_on": [{ - "gdpr_acceptance": "Yes" - }] + } }, "startdate": { "header": "", @@ -89,10 +61,7 @@ "hint_text": "For example, 27 3 2021.", "type": "date" } - }, - "depends_on": [{ - "gdpr_acceptance": "Yes" - }] + } }, "about_this_letting": { "header": "Tell us about this letting", @@ -132,10 +101,7 @@ "0": "Supported housing" } } - }, - "depends_on": [{ - "gdpr_acceptance": "Yes" - }] + } }, "tenant_code": { "header": "", @@ -148,10 +114,7 @@ "type": "text", "width": 10 } - }, - "depends_on": [{ - "gdpr_acceptance": "Yes" - }] + } }, "property_reference": { "header": "", @@ -164,8 +127,7 @@ "type": "text", "width": 10 } - }, - "depends_on": [{ "gdpr_acceptance": "Yes" }] + } } } } diff --git a/db/schema.rb b/db/schema.rb index 4305fb49c..9646f5029 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -130,8 +130,6 @@ ActiveRecord::Schema.define(version: 202202071123100) do t.datetime "discarded_at" t.string "tenancyother" t.integer "override_net_income_validation" - t.string "gdpr_acceptance" - t.string "gdpr_declined" t.string "property_owner_organisation" t.string "property_manager_organisation" t.string "sale_or_letting" diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb index a4bbfd021..b3c952ded 100644 --- a/spec/factories/case_log.rb +++ b/spec/factories/case_log.rb @@ -3,7 +3,6 @@ FactoryBot.define do owning_organisation { FactoryBot.create(:organisation) } managing_organisation { FactoryBot.create(:organisation) } trait :about_completed do - gdpr_acceptance { "Yes" } renewal { "No" } needstype { 1 } rent_type { 1 } @@ -112,8 +111,6 @@ FactoryBot.define do tenancyother { nil } override_net_income_validation { nil } net_income_known { "Weekly" } - gdpr_acceptance { "Yes" } - gdpr_declined { "No" } property_owner_organisation { "Test" } property_manager_organisation { "Test" } renewal { 1 } diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb index c51ddfa48..cde579bf4 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}/setup/check-answers") + visit("/logs/#{cycle_sections_case_log.id}/local-authority/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/features/form/tasklist_page_spec.rb b/spec/features/form/tasklist_page_spec.rb index 12a6afd6f..ba731e05e 100644 --- a/spec/features/form/tasklist_page_spec.rb +++ b/spec/features/form/tasklist_page_spec.rb @@ -33,12 +33,12 @@ RSpec.describe "Task List" do it "shows the number of completed sections if no sections are completed" do visit("/logs/#{empty_case_log.id}") - expect(page).to have_content("You have completed 0 of 10 sections.") + expect(page).to have_content("You have completed 0 of 9 sections.") end it "shows the number of completed sections if one section is completed" do answer_all_questions_in_income_subsection(empty_case_log) visit("/logs/#{empty_case_log.id}") - expect(page).to have_content("You have completed 1 of 10 sections.") + expect(page).to have_content("You have completed 1 of 9 sections.") end end diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index c3619f2c9..d3b9396bf 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -122,8 +122,6 @@ "rp_dontknow": "No", "discarded_at": "05/05/2020", "override_net_income_validation": "", - "gdpr_acceptance": "", - "gdpr_declined": "", "property_owner_organisation": "", "property_manager_organisation": "", "rent_type": "Social Rent", diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index c135d602c..12fb93b95 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -626,32 +626,6 @@ } } }, - "setup": { - "label": "Before you start", - "subsections": { - "setup": { - "label": "Set up your lettings log", - "pages": { - "gdpr_acceptance": { - "header": "", - "description": "", - "questions": { - "gdpr_acceptance": { - "check_answer_label": "Privacy notice seen", - "header": "Has the tenant or buyer seen the Department for Levelling Up, Housing and Communities (DLUHC) privacy notice?", - "hint_text": "You must show the privacy notice to the tenant or buyer before you can use this service.", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - } - } - } - } - } - } - }, "submission": { "label": "Submission", "subsections": { diff --git a/spec/fixtures/forms/2022_2023.json b/spec/fixtures/forms/2022_2023.json index 68d1c1247..b599e3067 100644 --- a/spec/fixtures/forms/2022_2023.json +++ b/spec/fixtures/forms/2022_2023.json @@ -7,30 +7,6 @@ "setup": { "label": "Set up your lettings log", "pages": { - "gdpr_acceptance": { - "header": "", - "description": "", - "questions": { - "gdpr_acceptance": { - "check_answer_label": "Privacy notice seen", - "header": "Has the tenant or buyer seen the Department for Levelling Up, Housing and Communities (DLUHC) privacy notice?", - "hint_text": "You must show the privacy notice to the tenant or buyer before you can use this service.", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No" - } - } - } - }, - "gdpr_declined": { - "header": "You cannot use this service", - "hint_text": "", - "description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.", - "questions": { - }, - "depends_on": [{ "gdpr_acceptance": "No" }] - }, "renewal": { "header": "", "description": "", @@ -45,10 +21,7 @@ "0": "No" } } - }, - "depends_on": [{ - "gdpr_acceptance": "Yes" - }] + } }, "startdate": { "header": "", @@ -60,10 +33,7 @@ "hint_text": "For example, 27 3 2007", "type": "date" } - }, - "depends_on": [{ - "gdpr_acceptance": "Yes" - }] + } }, "about_this_letting": { "header": "Tell us about this letting", @@ -101,10 +71,7 @@ "1": "General needs" } } - }, - "depends_on": [{ - "gdpr_acceptance": "Yes" - }] + } } } } diff --git a/spec/helpers/tasklist_helper_spec.rb b/spec/helpers/tasklist_helper_spec.rb index 578edf7c6..18b436a8a 100644 --- a/spec/helpers/tasklist_helper_spec.rb +++ b/spec/helpers/tasklist_helper_spec.rb @@ -22,7 +22,7 @@ RSpec.describe TasklistHelper do describe "get sections count" do it "returns the total of sections if no status is given" do - expect(get_subsections_count(empty_case_log)).to eq(10) + expect(get_subsections_count(empty_case_log)).to eq(9) end it "returns 0 sections for completed sections if no sections are completed" do @@ -30,7 +30,7 @@ RSpec.describe TasklistHelper do end it "returns the number of not started sections" do - expect(get_subsections_count(empty_case_log, :not_started)).to eq(9) + expect(get_subsections_count(empty_case_log, :not_started)).to eq(8) end it "returns the number of sections in progress" do diff --git a/spec/models/form/question_spec.rb b/spec/models/form/question_spec.rb index 2d166b73b..5d747311c 100644 --- a/spec/models/form/question_spec.rb +++ b/spec/models/form/question_spec.rb @@ -169,17 +169,5 @@ RSpec.describe Form::Question, type: :model do expect(question.completed?(case_log)).to be(true) end end - - context "when the gdpr acceptance is No" do - let(:section_id) { "setup" } - let(:subsection_id) { "setup" } - let(:page_id) { "gdpr_acceptance" } - let(:question_id) { "gdpr_acceptance" } - - it "returns false" do - case_log["gdpr_acceptance"] = "No" - expect(question.completed?(case_log)).to be(false) - end - end end end diff --git a/spec/models/form/subsection_spec.rb b/spec/models/form/subsection_spec.rb index f48c3ef4d..6bb2a36e2 100644 --- a/spec/models/form/subsection_spec.rb +++ b/spec/models/form/subsection_spec.rb @@ -77,16 +77,6 @@ RSpec.describe Form::Subsection, type: :model do end end - context "when the privacy notice has not been shown" do - let(:section_id) { "setup" } - let(:subsection_id) { "setup" } - let(:case_log) { FactoryBot.build(:case_log, :about_completed, gdpr_acceptance: "No") } - - it "does not mark the section as completed" do - expect(sub_section.status(case_log)).to eq(:in_progress) - end - end - context "with a completed case log" do let(:case_log) { FactoryBot.build(:case_log, :completed) } diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb index 94a6e9f9f..932ebdc75 100644 --- a/spec/models/form_handler_spec.rb +++ b/spec/models/form_handler_spec.rb @@ -17,7 +17,7 @@ RSpec.describe FormHandler do form_handler = described_class.instance form = form_handler.get_form(test_form_name) expect(form).to be_a(Form) - expect(form.pages.count).to eq(29) + expect(form.pages.count).to eq(28) end end diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index 4ab1b6ada..6180aa8d4 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -85,10 +85,6 @@ RSpec.describe Form, type: :model do case_log.mrcdate = Time.zone.parse("03/11/2019") end - def answer_local_gdpr_acceptance(case_log) - case_log.gdpr_acceptance = "Yes" - end - before do case_log.tenant_code = "123" case_log.age1 = 35 @@ -111,11 +107,6 @@ RSpec.describe Form, type: :model do expect(form.next_incomplete_section_redirect_path(subsection, case_log)).to eq("tenancy-code") end - it "returns the next incomplete section by cycling back around if next subsections are completed" do - answer_local_gdpr_acceptance(case_log) - expect(form.next_incomplete_section_redirect_path(later_subsection, case_log)).to eq("armed-forces") - end - it "returns the declaration section for a completed case log" do expect(form.next_incomplete_section_redirect_path(subsection, completed_case_log)).to eq("declaration") end @@ -128,7 +119,6 @@ RSpec.describe Form, type: :model do answer_income_and_benefits(case_log) answer_rent_and_charges(case_log) answer_local_authority(case_log) - answer_local_gdpr_acceptance(case_log) expect(form.next_incomplete_section_redirect_path(subsection, case_log)).to eq("declaration") end diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index 9fef47719..09f14089e 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -200,7 +200,7 @@ RSpec.describe CaseLogsController, type: :request do end it "displays a section status for a case log" do - assert_select ".govuk-tag", text: /Not started/, count: 9 + assert_select ".govuk-tag", text: /Not started/, count: 8 assert_select ".govuk-tag", text: /Completed/, count: 0 assert_select ".govuk-tag", text: /Cannot start yet/, count: 1 end @@ -222,7 +222,7 @@ RSpec.describe CaseLogsController, type: :request do end it "displays a section status for a case log" do - assert_select ".govuk-tag", text: /Not started/, count: 8 + assert_select ".govuk-tag", text: /Not started/, count: 7 assert_select ".govuk-tag", text: /Completed/, count: 1 assert_select ".govuk-tag", text: /Cannot start yet/, count: 1 end