Browse Source

feat: add bulk upload address info to lettings csv download

pull/2324/head
natdeanlewissoftwire 2 years ago
parent
commit
4ee3e774eb
  1. 6
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 2
      app/services/csv/lettings_log_csv_service.rb
  3. 10
      db/migrate/20240319092425_add_entered_address_fields_to_lettings_logs.rb
  4. 8
      db/schema.rb

6
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -1092,6 +1092,7 @@ private
attributes["lettype"] = nil # should get this from rent_type
attributes["tenancycode"] = field_13
attributes["la"] = field_23
attributes["la_as_entered"] = field_23
attributes["postcode_known"] = postcode_known
attributes["postcode_full"] = postcode_full
attributes["owning_organisation"] = owning_organisation
@ -1268,11 +1269,16 @@ private
attributes["skip_update_uprn_confirmed"] = true
attributes["uprn"] = field_16
attributes["address_line1"] = field_17
attributes["address_line1_as_entered"] = field_17
attributes["address_line2"] = field_18
attributes["address_line2_as_entered"] = field_18
attributes["town_or_city"] = field_19
attributes["town_or_city_as_entered"] = field_19
attributes["county"] = field_20
attributes["county_as_entered"] = field_20
attributes["address_line1_input"] = address_line1_input
attributes["postcode_full_input"] = postcode_full
attributes["postcode_full_as_entered"] = postcode_full
attributes["select_best_address_match"] = true if field_16.blank?
attributes

2
app/services/csv/lettings_log_csv_service.rb

@ -296,7 +296,7 @@ module Csv
"letting_allocation_unknown" => %w[letting_allocation_none],
}.freeze
SUPPORT_ONLY_ATTRIBUTES = %w[net_income_value_check first_time_property_let_as_social_housing postcode_known is_la_inferred totchild totelder totadult net_income_known previous_la_known is_previous_la_inferred age1_known age2_known age3_known age4_known age5_known age6_known age7_known age8_known details_known_2 details_known_3 details_known_4 details_known_5 details_known_6 details_known_7 details_known_8 wrent wscharge wpschrge wsupchrg wtcharge wtshortfall rent_value_check old_form_id old_id retirement_value_check tshortfall_known pregnancy_value_check hhtype new_old la prevloc updated_by_id bulk_upload_id uprn_confirmed address_line1_input postcode_full_input address_search_value_check uprn_selection reasonother_value_check].freeze
SUPPORT_ONLY_ATTRIBUTES = %w[net_income_value_check first_time_property_let_as_social_housing postcode_known is_la_inferred totchild totelder totadult net_income_known previous_la_known is_previous_la_inferred age1_known age2_known age3_known age4_known age5_known age6_known age7_known age8_known details_known_2 details_known_3 details_known_4 details_known_5 details_known_6 details_known_7 details_known_8 wrent wscharge wpschrge wsupchrg wtcharge wtshortfall rent_value_check old_form_id old_id retirement_value_check tshortfall_known pregnancy_value_check hhtype new_old la prevloc updated_by_id bulk_upload_id uprn_confirmed address_line1_input postcode_full_input address_search_value_check uprn_selection reasonother_value_check address_line1_as_entered address_line2_as_entered town_or_city_as_entered county_as_entered postcode_full_as_entered la_as_entered].freeze
def lettings_log_attributes
ordered_questions = FormHandler.instance.ordered_lettings_questions_for_all_years

10
db/migrate/20240319092425_add_entered_address_fields_to_lettings_logs.rb

@ -0,0 +1,10 @@
class AddEnteredAddressFieldsToLettingsLogs < ActiveRecord::Migration[7.0]
def change
add_column :lettings_logs, :address_line1_as_entered, :string
add_column :lettings_logs, :address_line2_as_entered, :string
add_column :lettings_logs, :town_or_city_as_entered, :string
add_column :lettings_logs, :county_as_entered, :string
add_column :lettings_logs, :postcode_full_as_entered, :string
add_column :lettings_logs, :la_as_entered, :string
end
end

8
db/schema.rb

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2024_03_11_102706) do
ActiveRecord::Schema[7.0].define(version: 2024_03_19_092425) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -312,6 +312,12 @@ ActiveRecord::Schema[7.0].define(version: 2024_03_11_102706) do
t.string "postcode_full_input"
t.integer "address_search_value_check"
t.string "uprn_selection"
t.string "address_line1_as_entered"
t.string "address_line2_as_entered"
t.string "town_or_city_as_entered"
t.string "county_as_entered"
t.string "postcode_full_as_entered"
t.string "la_as_entered"
t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id"
t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id"
t.index ["location_id"], name: "index_lettings_logs_on_location_id"

Loading…
Cancel
Save