Browse Source

changed type of unit type in db

pull/704/head
JG 3 years ago
parent
commit
efb6a32c9d
  1. 2
      app/controllers/locations_controller.rb
  2. 11
      app/views/locations/new.html.erb
  3. 6
      db/migrate/20220630120251_change_location_type_of_unit.rb
  4. 2
      db/schema.rb

2
app/controllers/locations_controller.rb

@ -3,7 +3,7 @@ class LocationsController < ApplicationController
before_action :authenticate_scope!
def new
@scheme = Scheme.find(12)
@scheme = Scheme.find(params[:id])
@location = Location.new
end

11
app/views/locations/new.html.erb

@ -23,6 +23,17 @@
label: { text: "Name (optional)", size: "m" },
hint: { text: "This is how you refer to this location within your organisation" } %>
<%= f.govuk_number_field :total_units,
label: { text: "Total number of units at this location", size: "m" },
width: 2,
hint: { text: "A unit can be a bedroom in a shared house or flat, or a house with 4 bedrooms. Do not include bedrooms used for wardens, managers, volunteers or sleep-in staff.s" },
autofocus: true %>
<%= f.govuk_collection_radio_buttons :scheme_type,
scheme_types_selection,
:id,
:name,
legend: { text: "What is this type of scheme?", size: "m" } %>
<%= f.govuk_submit "Save and continue" %>
</div>

6
db/migrate/20220630120251_change_location_type_of_unit.rb

@ -0,0 +1,6 @@
class ChangeLocationTypeOfUnit < ActiveRecord::Migration[7.0]
def change
remove_column :locations, :type_of_unit
add_column :locations, :type_of_unit, :integer
end
end

2
db/schema.rb

@ -239,7 +239,6 @@ ActiveRecord::Schema[7.0].define(version: 2022_07_04_135746) do
create_table "locations", force: :cascade do |t|
t.string "location_code"
t.string "postcode"
t.string "type_of_unit"
t.string "type_of_building"
t.integer "wheelchair_adaptation"
t.bigint "scheme_id", null: false
@ -249,6 +248,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_07_04_135746) do
t.datetime "updated_at", null: false
t.string "name"
t.integer "total_units"
t.integer "type_of_unit"
t.index ["scheme_id"], name: "index_locations_on_scheme_id"
end

Loading…
Cancel
Save