diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 51dc6ff4d..07ba1cc07 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -617,6 +617,10 @@ class LettingsLog < Log is_carehome? ? "chcharge" : nil].compact end + def letting_allocation_none + letting_allocation_unknown + end + private def reset_invalid_unresolved_log_fields! diff --git a/app/services/csv/lettings_log_csv_service.rb b/app/services/csv/lettings_log_csv_service.rb index fd47e8588..2b4c1cdd5 100644 --- a/app/services/csv/lettings_log_csv_service.rb +++ b/app/services/csv/lettings_log_csv_service.rb @@ -219,20 +219,21 @@ module Csv "tcharge" => %w[tcharge wtcharge], "chcharge" => %w[chcharge wchchrg], "tshortfall" => %w[tshortfall wtshortfall], + "letting_allocation_unknown" => %w[letting_allocation_none], }.freeze - SUPPORT_ONLY_ATTRIBUTES = %w[hhmemb net_income_value_check first_time_property_let_as_social_housing renttype needstype postcode_known is_la_inferred totchild totelder totadult net_income_known is_carehome previous_la_known is_previous_la_inferred age1_known age2_known age3_known age4_known age5_known age6_known age7_known age8_known letting_allocation_unknown details_known_2 details_known_3 details_known_4 details_known_5 details_known_6 details_known_7 details_known_8 rent_type_detail 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].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].freeze def lettings_log_attributes ordered_questions = FormHandler.instance.ordered_lettings_questions_for_all_years ordered_questions.reject! { |q| q.id.match?(/age\d_known|rent_value_check/) } attributes = ordered_questions.flat_map do |question| if question.type == "checkbox" - question.answer_options.keys.reject { |key| key == "divider" } - elsif ATTRIBUTE_MAPPINGS.key? question.id - ATTRIBUTE_MAPPINGS[question.id] + question.answer_options.keys.reject { |key| key == "divider" }.map do |key| + ATTRIBUTE_MAPPINGS.fetch(key, key) + end.flatten else - question.id + ATTRIBUTE_MAPPINGS.fetch(question.id, question.id) end end non_question_fields = %w[id status created_by is_dpo created_at updated_by updated_at creation_method old_id old_form_id collection_start_year]