Browse Source

Remove gdpr fields

pull/279/head
Kat 3 years ago
parent
commit
007a222aff
  1. 3
      app/models/bulk_upload.rb
  2. 1
      app/models/form/question.rb
  3. 50
      config/forms/2021_2022.json
  4. 2
      db/schema.rb
  5. 3
      spec/factories/case_log.rb
  6. 2
      spec/features/form/check_answers_page_spec.rb
  7. 4
      spec/features/form/tasklist_page_spec.rb
  8. 2
      spec/fixtures/complete_case_log.json
  9. 26
      spec/fixtures/forms/2021_2022.json
  10. 39
      spec/fixtures/forms/2022_2023.json
  11. 4
      spec/helpers/tasklist_helper_spec.rb
  12. 12
      spec/models/form/question_spec.rb
  13. 10
      spec/models/form/subsection_spec.rb
  14. 2
      spec/models/form_handler_spec.rb
  15. 10
      spec/models/form_spec.rb
  16. 4
      spec/requests/case_logs_controller_spec.rb

3
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

1
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)

50
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 <a class=\"govuk-link\" href=\"/files/privacy-notice.pdf\">show the privacy notice</a> 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 <a class=\"govuk-link\" href=\"/files/privacy-notice.pdf\">DLUHC privacy notice</a>.<br /><br /><a class=\"govuk-link\" href=\"/logs\">Go to your logs</a>",
"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" }]
}
}
}
}

2
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"

3
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 }

2
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

4
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

2
spec/fixtures/complete_case_log.json vendored

@ -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",

26
spec/fixtures/forms/2021_2022.json vendored

@ -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 <a class=\"govuk-link\" href=\"/files/privacy-notice.pdf\">show the privacy notice</a> to the tenant or buyer before you can use this service.",
"type": "radio",
"answer_options": {
"0": "Yes",
"1": "No"
}
}
}
}
}
}
}
},
"submission": {
"label": "Submission",
"subsections": {

39
spec/fixtures/forms/2022_2023.json vendored

@ -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 <a class=\"govuk-link\" href=\"/files/privacy-notice.pdf\">show the privacy notice</a> 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"
}]
}
}
}
}

4
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

12
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

10
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) }

2
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

10
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

4
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

Loading…
Cancel
Save