diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb
index ffb68c226..bb92a2df6 100644
--- a/app/controllers/locations_controller.rb
+++ b/app/controllers/locations_controller.rb
@@ -88,7 +88,7 @@ private
end
def location_params
- required_params = params.require(:location).permit(:postcode, :name, :units, :type_of_unit, :wheelchair_adaptation, :add_another_location, :startdate).merge(scheme_id: @scheme.id)
+ required_params = params.require(:location).permit(:postcode, :name, :units, :type_of_unit, :wheelchair_adaptation, :add_another_location, :startdate, :mobility_type).merge(scheme_id: @scheme.id)
required_params[:postcode] = PostcodeService.clean(required_params[:postcode]) if required_params[:postcode]
required_params
end
diff --git a/app/models/location.rb b/app/models/location.rb
index 0d5bf1a76..8ec88c8bb 100644
--- a/app/models/location.rb
+++ b/app/models/location.rb
@@ -15,10 +15,10 @@ class Location < ApplicationRecord
enum wheelchair_adaptation: WHEELCHAIR_ADAPTATIONS
MOBILITY_TYPE = {
- "Property fitted with equipment and adaptations (if not designed to above standards)": "A",
+ "Wheelchair-user standard": "W",
+ "Fitted with equipment and adaptations": "A",
"Property designed to accessible general standard": "M",
"None": "N",
- "Property designed to wheelchair user standard": "W",
"Missing": "X",
}.freeze
diff --git a/app/views/locations/edit.html.erb b/app/views/locations/edit.html.erb
index 227605485..0549e8d0f 100644
--- a/app/views/locations/edit.html.erb
+++ b/app/views/locations/edit.html.erb
@@ -36,6 +36,17 @@
:name,
legend: { text: I18n.t("questions.location.type_of_unit"), size: "m" } %>
+ <% mobility_types_to_display = Location.mobility_types.excluding("Property designed to accessible general standard", "Missing") %>
+
+ <% mobility_type_selection = mobility_types_to_display.map { |key, value| OpenStruct.new(id: key, name: key.to_s.humanize, description: I18n.t("questions.descriptions.location.mobility_type.#{value}")) } %>
+
+ <%= f.govuk_collection_radio_buttons :mobility_type,
+ mobility_type_selection,
+ :id,
+ :name,
+ :description,
+ legend: { text: I18n.t("questions.location.mobility_type"), size: "m" } %>
+
<% wheelchair_user_selection = Location.wheelchair_adaptations.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %>
<%= f.govuk_collection_radio_buttons :wheelchair_adaptation,
wheelchair_user_selection,
diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb
index 2fa495d2a..dc04399c6 100644
--- a/app/views/locations/index.html.erb
+++ b/app/views/locations/index.html.erb
@@ -30,6 +30,9 @@
<% row.cell(header: true, text: "Common unit type", html_attributes: {
scope: "col",
}) %>
+ <% row.cell(header: true, text: "Mobility type", html_attributes: {
+ scope: "col",
+ }) %>
<% end %>
<% end %>
<% @locations.each do |location| %>
@@ -39,7 +42,8 @@
<% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit-name"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
<% row.cell(text: location.units) %>
<% row.cell(text: simple_format("#{location.type_of_unit}#{location.wheelchair_adaptation == 'Yes' ? "\nWith wheelchair adaptations" : ''}")) %>
- <% end %>
+ <% row.cell(text: location.mobility_type) %>
+ <% end %>
<% end %>
<% end %>
<% end %>
diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb
index 669a39594..524382b2d 100644
--- a/app/views/locations/new.html.erb
+++ b/app/views/locations/new.html.erb
@@ -46,6 +46,17 @@
hint: { text: I18n.t("hints.location.wheelchair_adaptation") },
legend: { text: I18n.t("questions.location.wheelchair_adaptation"), size: "m" } %>
+ <% mobility_types_to_display = Location.mobility_types.excluding("Property designed to accessible general standard", "Missing") %>
+
+ <% mobility_type_selection = mobility_types_to_display.map { |key, value| OpenStruct.new(id: key, name: key.to_s.humanize, description: I18n.t("questions.descriptions.location.mobility_type.#{value}")) } %>
+
+ <%= f.govuk_collection_radio_buttons :mobility_type,
+ mobility_type_selection,
+ :id,
+ :name,
+ :description,
+ legend: { text: I18n.t("questions.location.mobility_type"), size: "m" } %>
+
<%= f.govuk_date_field :startdate,
legend: { text: I18n.t("questions.location.startdate"), size: "m" },
width: 20 %>
diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb
index ef3bd16ed..8028631f3 100644
--- a/app/views/schemes/check_answers.html.erb
+++ b/app/views/schemes/check_answers.html.erb
@@ -90,6 +90,9 @@
<% row.cell(header: true, text: "Common unit type", html_attributes: {
scope: "col",
}) %>
+ <% row.cell(header: true, text: "Mobility type", html_attributes: {
+ scope: "col",
+ }) %>
<% end %>
<% end %>
<% @scheme.locations.each do |location| %>
@@ -99,7 +102,8 @@
<% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
<% row.cell(text: location.units) %>
<% row.cell(text: simple_format("#{location.type_of_unit}#{location.wheelchair_adaptation == 'Yes' ? "\nWith wheelchair adaptations" : ''}")) %>
- <% end %>
+ <% row.cell(text: location.mobility_type) %>
+ <% end %>
<% end %>
<% end %>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 895bf023e..b18e775e0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -326,6 +326,13 @@ en:
wheelchair_adaptation: "Are the majority of units in this location built or adapted to wheelchair-user standards?"
startdate: "When did the first property in this location become available under this scheme?"
add_another_location: "Do you want to add another location?"
+ mobility_type: "What are the mobility standards for the majority of units in this location?"
+ descriptions:
+ location:
+ mobility_type:
+ W: "The majority of units are suitable for someone who uses a wheelchair and offer the full use of all rooms and facilities."
+ A: "For example, the majority of units have been fitted with stairlifts, ramps, level access showers or grab rails."
+ N: "The majority of units are not designed to wheelchair-user standards or fitted with any equipment and adaptations."
hints:
location:
diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb
index 6d94123ce..32567587c 100644
--- a/spec/features/schemes_spec.rb
+++ b/spec/features/schemes_spec.rb
@@ -209,6 +209,10 @@ RSpec.describe "Schemes scheme Features" do
it "shows details of those locations" do
locations.each do |location|
expect(page).to have_content(location.id)
+ expect(page).to have_content(location.postcode)
+ expect(page).to have_content(location.units)
+ expect(page).to have_content(location.type_of_unit)
+ expect(page).to have_content(location.mobility_type)
end
end
end
@@ -405,6 +409,7 @@ RSpec.describe "Schemes scheme Features" do
choose "Self-contained house"
choose "location-wheelchair-adaptation-no-field"
choose "location-add-another-location-no-field"
+ choose "location-mobility-type-none-field"
click_button "Save and continue"
end
@@ -426,6 +431,7 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "SW1P4DF"
expect(page).to have_content "Some name"
expect(page).to have_content "Self-contained house"
+ expect(page).to have_content "None"
end
end
@@ -465,6 +471,7 @@ RSpec.describe "Schemes scheme Features" do
before do
click_link "XX11XX"
fill_in "Postcode", with: "ZZ1 1ZZ"
+ choose "location-mobility-type-wheelchair-user-standard-field"
click_button "Save and continue"
end
@@ -472,6 +479,7 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "Locations"
expect(page).to have_content "#{scheme.locations.count} location"
expect(page).to have_content "ZZ11ZZ"
+ expect(page).to have_content("Wheelchair-user standard")
end
end
end
diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb
index 9bcab3544..00f4e62dc 100644
--- a/spec/requests/locations_controller_spec.rb
+++ b/spec/requests/locations_controller_spec.rb
@@ -91,7 +91,7 @@ RSpec.describe LocationsController, type: :request do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) }
let(:startdate) { Time.utc(2022, 2, 2) }
- let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "No", postcode: "ZZ1 1ZZ", startdate: } } }
+ let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "No", postcode: "ZZ1 1ZZ", startdate:, mobility_type: "A" } } }
before do
sign_in user
@@ -113,6 +113,7 @@ RSpec.describe LocationsController, type: :request do
expect(Location.last.type_of_unit).to eq("Bungalow")
expect(Location.last.wheelchair_adaptation).to eq("No")
expect(Location.last.startdate).to eq(startdate)
+ expect(Location.last.mobility_type).to eq("Fitted with equipment and adaptations")
end
context "when postcode is submitted with lower case" do
@@ -134,7 +135,7 @@ RSpec.describe LocationsController, type: :request do
end
context "when do you want to add another location is selected as yes" do
- let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "Yes", postcode: "ZZ1 1ZZ" } } }
+ let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", add_another_location: "Yes", postcode: "ZZ1 1ZZ", mobility_type: "N" } } }
it "creates a new location for scheme with valid params and redirects to correct page" do
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1)
@@ -149,6 +150,7 @@ RSpec.describe LocationsController, type: :request do
expect(Location.last.units).to eq(5)
expect(Location.last.type_of_unit).to eq("Bungalow")
expect(Location.last.wheelchair_adaptation).to eq("No")
+ expect(Location.last.mobility_type).to eq("None")
end
end
@@ -172,7 +174,7 @@ RSpec.describe LocationsController, type: :request do
end
context "when do you want to add another location is not selected" do
- let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", postcode: "ZZ1 1ZZ" } } }
+ let(:params) { { location: { name: "Test", units: "5", type_of_unit: "Bungalow", wheelchair_adaptation: "No", postcode: "ZZ1 1ZZ", mobility_type: "W" } } }
it "creates a new location for scheme with valid params and redirects to correct page" do
expect { post "/schemes/#{scheme.id}/locations", params: }.to change(Location, :count).by(1)
@@ -187,6 +189,7 @@ RSpec.describe LocationsController, type: :request do
expect(Location.last.units).to eq(5)
expect(Location.last.type_of_unit).to eq("Bungalow")
expect(Location.last.wheelchair_adaptation).to eq("No")
+ expect(Location.last.mobility_type).to eq("Wheelchair-user standard")
end
end
diff --git a/spec/services/imports/scheme_location_import_service_spec.rb b/spec/services/imports/scheme_location_import_service_spec.rb
index a7c13aaca..8683087cb 100644
--- a/spec/services/imports/scheme_location_import_service_spec.rb
+++ b/spec/services/imports/scheme_location_import_service_spec.rb
@@ -134,7 +134,7 @@ RSpec.describe Imports::SchemeLocationImportService do
expect(location.name).to eq("Location 1")
expect(location.postcode).to eq("S44 6EJ")
expect(location.units).to eq(5)
- expect(location.mobility_type).to eq("Property fitted with equipment and adaptations (if not designed to above standards)")
+ expect(location.mobility_type).to eq("Fitted with equipment and adaptations")
expect(location.type_of_unit).to eq("Bungalow")
expect(location.old_id).to eq(first_location_id)
expect(location.old_visible_id).to eq(10)