diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb
index 7a0928907..38db72aa5 100644
--- a/app/controllers/form_controller.rb
+++ b/app/controllers/form_controller.rb
@@ -178,7 +178,7 @@ private
unless saved_duplicates == dynamic_duplicates
duplicate_log_reference = DuplicateLogReference.find_or_create_by!(log_id: @log.id, log_type: "LettingsLog")
dynamic_duplicates.each do |duplicate|
- DuplicateLogReference.find_or_create_by!(log_id: duplicate.id, log_type: "LettingsLog", duplicate_log_reference_id: duplicate_log_reference.duplicate_log_reference_id)
+ DuplicateLogReference.find_or_create_by!(log_id: duplicate.id, log_type: "LettingsLog", duplicate_set_id: duplicate_log_reference.duplicate_set_id)
end
return send("lettings_log_duplicate_logs_path", @log, original_log_id: @log.id)
end
@@ -294,8 +294,8 @@ private
duplicate_log_reference = DuplicateLogReference.find_by(log_id: log.id, log_type: log.class.name)
return unless duplicate_log_reference
- duplicate_log_reference_id = duplicate_log_reference.duplicate_log_reference_id
+ duplicate_set_id = duplicate_log_reference.duplicate_set_id
duplicate_log_reference.destroy! if duplicate_log_reference.present?
- DuplicateLogReference.find_by(duplicate_log_reference_id:).destroy! if DuplicateLogReference.where(duplicate_log_reference_id:).count == 1
+ DuplicateLogReference.find_by(duplicate_set_id:).destroy! if DuplicateLogReference.where(duplicate_set_id:).count == 1
end
end
diff --git a/app/models/duplicate_log_reference.rb b/app/models/duplicate_log_reference.rb
index a8ef83444..a14347959 100644
--- a/app/models/duplicate_log_reference.rb
+++ b/app/models/duplicate_log_reference.rb
@@ -1,18 +1,18 @@
class DuplicateLogReference < ApplicationRecord
belongs_to :log, polymorphic: true
- before_create :set_default_duplicate_log_reference_id
+ before_create :set_default_duplicate_set_id
private
- def set_default_duplicate_log_reference_id
- self.duplicate_log_reference_id ||= generate_new_id
+ def set_default_duplicate_set_id
+ self.duplicate_set_id ||= generate_new_id
end
def generate_new_id
loop do
- duplicate_log_reference_id = SecureRandom.random_number(1_000_000)
- return duplicate_log_reference_id unless DuplicateLogReference.exists?(duplicate_log_reference_id:)
+ duplicate_set_id = SecureRandom.random_number(1_000_000)
+ return duplicate_set_id unless DuplicateLogReference.exists?(duplicate_set_id:)
end
end
end
diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb
index d6f4524e7..28407cf28 100644
--- a/app/models/lettings_log.rb
+++ b/app/models/lettings_log.rb
@@ -646,7 +646,7 @@ class LettingsLog < Log
end
def duplicates
- LettingsLog.joins(:duplicate_log_references).where(duplicate_log_references: { duplicate_log_reference_id: duplicate_log_references&.first&.duplicate_log_reference_id }).where.not(id:)
+ LettingsLog.joins(:duplicate_log_references).where(duplicate_log_references: { duplicate_set_id: duplicate_log_references&.first&.duplicate_set_id }).where.not(id:)
end
private
diff --git a/app/models/log.rb b/app/models/log.rb
index 5511b9041..cccdf2fbb 100644
--- a/app/models/log.rb
+++ b/app/models/log.rb
@@ -210,8 +210,8 @@ class Log < ApplicationRecord
end
end
- def duplicate_log_reference_id
- duplicate_log_references.first&.duplicate_log_reference_id
+ def duplicate_set_id
+ duplicate_log_references.first&.duplicate_set_id
end
private
diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb
index 197406273..eea3d60f6 100644
--- a/app/models/sales_log.rb
+++ b/app/models/sales_log.rb
@@ -458,6 +458,6 @@ class SalesLog < Log
end
def duplicates
- SalesLog.joins(:duplicate_log_references).where(duplicate_log_references: { duplicate_log_reference_id: duplicate_log_references&.first&.duplicate_log_reference_id }).where.not(id:)
+ SalesLog.joins(:duplicate_log_references).where(duplicate_log_references: { duplicate_set_id: duplicate_log_references&.first&.duplicate_set_id }).where.not(id:)
end
end
diff --git a/app/services/csv/lettings_log_csv_service.rb b/app/services/csv/lettings_log_csv_service.rb
index 5b80b3c7f..3f25425b4 100644
--- a/app/services/csv/lettings_log_csv_service.rb
+++ b/app/services/csv/lettings_log_csv_service.rb
@@ -299,7 +299,7 @@ module Csv
ATTRIBUTE_MAPPINGS.fetch(question.id, question.id)
end
end
- non_question_fields = %w[id status duplicate_log_reference_id created_by is_dpo created_at updated_by updated_at creation_method old_id old_form_id collection_start_year]
+ non_question_fields = %w[id status duplicate_set_id created_by is_dpo created_at updated_by updated_at creation_method old_id old_form_id collection_start_year]
scheme_and_location_attributes = %w[scheme_code scheme_service_name scheme_sensitive SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate]
final_attributes = non_question_fields + attributes + scheme_and_location_attributes
@user.support? ? final_attributes : final_attributes - SUPPORT_ONLY_ATTRIBUTES
diff --git a/app/services/csv/sales_log_csv_service.rb b/app/services/csv/sales_log_csv_service.rb
index 9c3d16295..83c8e9cbf 100644
--- a/app/services/csv/sales_log_csv_service.rb
+++ b/app/services/csv/sales_log_csv_service.rb
@@ -144,7 +144,7 @@ module Csv
question.id
end
end
- non_question_fields = %w[id status duplicate_log_reference_id created_at updated_at old_form_id collection_start_year creation_method is_dpo]
+ non_question_fields = %w[id status duplicate_set_id created_at updated_at old_form_id collection_start_year creation_method is_dpo]
non_question_fields + attributes
end
diff --git a/app/services/exports/lettings_log_export_constants.rb b/app/services/exports/lettings_log_export_constants.rb
index 6186c60ae..0d460a19f 100644
--- a/app/services/exports/lettings_log_export_constants.rb
+++ b/app/services/exports/lettings_log_export_constants.rb
@@ -137,7 +137,7 @@ module Exports::LettingsLogExportConstants
"location_status",
"created_by",
"amended_by",
- "duplicate_log_reference_id"
+ "duplicate_set_id"
]
(1..8).each do |index|
diff --git a/app/services/exports/lettings_log_export_service.rb b/app/services/exports/lettings_log_export_service.rb
index 23a91bb5d..6cea0824b 100644
--- a/app/services/exports/lettings_log_export_service.rb
+++ b/app/services/exports/lettings_log_export_service.rb
@@ -226,7 +226,7 @@ module Exports
attribute_hash["relat#{index}"] = "R"
attribute_hash["ecstat#{index}"] = 10
end
- attribute_hash["duplicate_log_reference_id"] = lettings_log.duplicate_log_reference_id
+ attribute_hash["duplicate_set_id"] = lettings_log.duplicate_set_id
attribute_hash
end
diff --git a/db/migrate/20240110101500_create_duplicate_log_references.rb b/db/migrate/20240110101500_create_duplicate_log_references.rb
index 1edae4a38..d12793c63 100644
--- a/db/migrate/20240110101500_create_duplicate_log_references.rb
+++ b/db/migrate/20240110101500_create_duplicate_log_references.rb
@@ -1,7 +1,7 @@
class CreateDuplicateLogReferences < ActiveRecord::Migration[7.0]
def change
create_table :duplicate_log_references do |t|
- t.integer :duplicate_log_reference_id
+ t.integer :duplicate_set_id
t.integer :log_id
t.string :log_type
diff --git a/db/schema.rb b/db/schema.rb
index 56e10ac0f..242205d2c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -64,7 +64,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_01_10_101500) do
end
create_table "duplicate_log_references", force: :cascade do |t|
- t.integer "duplicate_log_reference_id"
+ t.integer "duplicate_set_id"
t.integer "log_id"
t.string "log_type"
t.datetime "created_at", null: false
diff --git a/lib/tasks/set_duplicate_references.rake b/lib/tasks/set_duplicate_references.rake
index 98b5a11ce..cf3d1932b 100644
--- a/lib/tasks/set_duplicate_references.rake
+++ b/lib/tasks/set_duplicate_references.rake
@@ -1,27 +1,27 @@
desc "Set duplicate references for sales and lettings logs"
task set_duplicate_references: :environment do
SalesLog.filter_by_year(2023).duplicate_sets.each do |duplicate_set|
- duplicate_log_reference_id = generate_new_duplicate_log_reference_id
+ duplicate_set_id = generate_new_duplicate_set_id
next if duplicate_set.any? { |log_id| DuplicateLogReference.exists?(log_id:, log_type: "SalesLog") }
duplicate_set.each do |log_id|
- DuplicateLogReference.create(log_id:, log_type: "SalesLog", duplicate_log_reference_id:)
+ DuplicateLogReference.create(log_id:, log_type: "SalesLog", duplicate_set_id:)
end
end
LettingsLog.filter_by_year(2023).duplicate_sets.each do |duplicate_set|
- duplicate_log_reference_id = generate_new_duplicate_log_reference_id
+ duplicate_set_id = generate_new_duplicate_set_id
next if duplicate_set.any? { |log_id| DuplicateLogReference.exists?(log_id:, log_type: "LettingsLog") }
duplicate_set.each do |log_id|
- DuplicateLogReference.create(log_id:, log_type: "LettingsLog", duplicate_log_reference_id:)
+ DuplicateLogReference.create(log_id:, log_type: "LettingsLog", duplicate_set_id:)
end
end
end
-def generate_new_duplicate_log_reference_id
+def generate_new_duplicate_set_id
loop do
- duplicate_log_reference_id = SecureRandom.random_number(1_000_000)
- return duplicate_log_reference_id unless DuplicateLogReference.exists?(duplicate_log_reference_id:)
+ duplicate_set_id = SecureRandom.random_number(1_000_000)
+ return duplicate_set_id unless DuplicateLogReference.exists?(duplicate_set_id:)
end
end
diff --git a/spec/factories/duplicate_log_reference.rb b/spec/factories/duplicate_log_reference.rb
index 955979790..bb5a5c3dd 100644
--- a/spec/factories/duplicate_log_reference.rb
+++ b/spec/factories/duplicate_log_reference.rb
@@ -2,7 +2,7 @@ FactoryBot.define do
factory :duplicate_log_reference do
log_id { 1 }
log_type { "SalesLog" }
- duplicate_log_reference_id { nil }
+ duplicate_set_id { nil }
created_at { Time.zone.today }
updated_at { Time.zone.today }
end
diff --git a/spec/fixtures/exports/general_needs_log.xml b/spec/fixtures/exports/general_needs_log.xml
index 77a691faf..1a0ed7197 100644
--- a/spec/fixtures/exports/general_needs_log.xml
+++ b/spec/fixtures/exports/general_needs_log.xml
@@ -156,7 +156,7 @@
{log_id}
test1@example.com
-
+
1
diff --git a/spec/fixtures/exports/general_needs_log_23_24.xml b/spec/fixtures/exports/general_needs_log_23_24.xml
index c0a237f90..3efc705cd 100644
--- a/spec/fixtures/exports/general_needs_log_23_24.xml
+++ b/spec/fixtures/exports/general_needs_log_23_24.xml
@@ -157,7 +157,7 @@
{log_id}
test1@example.com
-
+
1
diff --git a/spec/fixtures/exports/supported_housing_logs.xml b/spec/fixtures/exports/supported_housing_logs.xml
index 0d62cd26f..eb91ac60c 100644
--- a/spec/fixtures/exports/supported_housing_logs.xml
+++ b/spec/fixtures/exports/supported_housing_logs.xml
@@ -172,7 +172,7 @@
20
{location_id}
active
-
+
1
diff --git a/spec/fixtures/files/lettings_log_csv_export_codes.csv b/spec/fixtures/files/lettings_log_csv_export_codes.csv
index 42d6273ec..28e3832c6 100644
--- a/spec/fixtures/files/lettings_log_csv_export_codes.csv
+++ b/spec/fixtures/files/lettings_log_csv_export_codes.csv
@@ -1,2 +1,2 @@
-id,status,duplicate_log_reference_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,new_old,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,earnings,incfreq,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
+id,status,duplicate_set_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,new_old,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,earnings,incfreq,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,s.port@jeemayle.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-06-26,2,1,1,,2,HIJKLMN,ABCDEFG,0,,,fake address,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-06-24,,,1,2023-06-25,,3,1,4,,2,,1,4,,1,4,0,0,2,35,,F,0,2,13,0,0,P,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,2,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,,0,0,268,1,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,,
diff --git a/spec/fixtures/files/lettings_log_csv_export_labels.csv b/spec/fixtures/files/lettings_log_csv_export_labels.csv
index 4d5e35814..088e85d22 100644
--- a/spec/fixtures/files/lettings_log_csv_export_labels.csv
+++ b/spec/fixtures/files/lettings_log_csv_export_labels.csv
@@ -1,2 +1,2 @@
-id,status,duplicate_log_reference_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,new_old,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,earnings,incfreq,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
+id,status,duplicate_set_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,new_old,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,earnings,incfreq,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,s.port@jeemayle.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,single log,,,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-06-26,2,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,No,,,fake address,,London,,NW9 5LL,No,Barnet,E09000003,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-06-24,,,Yes,2023-06-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,,Yes,4,0,0,2,35,,Female,White,Irish,Tenant prefers not to say,Other,Yes,Partner,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,2,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),,Yes,No,268,Weekly,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,,
diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_codes.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_codes.csv
index 97334debb..e985d96b7 100644
--- a/spec/fixtures/files/lettings_log_csv_export_non_support_codes.csv
+++ b/spec/fixtures/files/lettings_log_csv_export_non_support_codes.csv
@@ -1,2 +1,2 @@
-id,status,duplicate_log_reference_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
+id,status,duplicate_set_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,choreographer@owtluk.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,1,2023,DLUHC,DLUHC,1,7,0,2023-06-26,2,1,1,,2,HIJKLMN,ABCDEFG,0,,fake address,,London,,NW9 5LL,Barnet,2,6,2,2,7,1,1,3,2023-06-24,1,,1,2023-06-25,,3,1,4,,2,,1,4,1,35,F,0,2,13,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,,2,,0,268,1,6,1,1,,0,2,,,,,200.0,50.0,40.0,35.0,325.0,,,,1,12.0,,,,,,,,,,,,,,,,,,,,
diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_labels.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_labels.csv
index 06dc176cd..8424dbccd 100644
--- a/spec/fixtures/files/lettings_log_csv_export_non_support_labels.csv
+++ b/spec/fixtures/files/lettings_log_csv_export_non_support_labels.csv
@@ -1,2 +1,2 @@
-id,status,duplicate_log_reference_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
+id,status,duplicate_set_id,created_by,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,rent_type_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,incref,earnings,incfreq,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,scharge,pscharge,supcharg,tcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_sensitive,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,choreographer@owtluk.com,false,2023-06-26T00:00:00+01:00,,2023-06-26T00:00:00+01:00,single log,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-06-26,2,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,No,,fake address,,London,,NW9 5LL,Barnet,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-06-24,1,,Yes,2023-06-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,Yes,35,Female,White,Irish,Tenant prefers not to say,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),,No,268,Weekly,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,50.0,40.0,35.0,325.0,,,,Yes,12.0,,,,,,,,,,,,,,,,,,,,
diff --git a/spec/fixtures/files/sales_logs_csv_export_codes.csv b/spec/fixtures/files/sales_logs_csv_export_codes.csv
index 24e5f5132..46e63c3db 100644
--- a/spec/fixtures/files/sales_logs_csv_export_codes.csv
+++ b/spec/fixtures/files/sales_logs_csv_export_codes.csv
@@ -1,2 +1,2 @@
-id,status,duplicate_log_reference_id,created_at,updated_at,old_form_id,collection_start_year,creation_method,is_dpo,owning_organisation_name,managing_organisation_name,created_by,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,beds,proptype,builtype,pcodenk,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,pcode1,pcode2,la_known,la,la_label,wchair,noint,privacynotice,age1,sex1,ethnic_group,ethnic,national,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationalbuy2,ecstat2,buy2livein,hholdcount,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,prevten,ppcodenk,ppostc1,ppostc2,previous_la_known,prevloc,prevloc_label,pregyrha,pregother,pregla,pregghb,pregblank,buy2living,prevtenbuy2,hhregres,hhregresstill,armedforcesspouse,disabled,wheel,income1nk,income1,inc1mort,income2nk,income2,inc2mort,hb,savingsnk,savings,prevown,prevshared,proplen,staircase,stairbought,stairowned,staircasesale,resale,exday,exmonth,exyear,hoday,homonth,hoyear,lanomagr,soctenant,frombeds,fromprop,socprevten,value,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,discount,grant
+id,status,duplicate_set_id,created_at,updated_at,old_form_id,collection_start_year,creation_method,is_dpo,owning_organisation_name,managing_organisation_name,created_by,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,beds,proptype,builtype,pcodenk,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,pcode1,pcode2,la_known,la,la_label,wchair,noint,privacynotice,age1,sex1,ethnic_group,ethnic,national,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationalbuy2,ecstat2,buy2livein,hholdcount,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,prevten,ppcodenk,ppostc1,ppostc2,previous_la_known,prevloc,prevloc_label,pregyrha,pregother,pregla,pregghb,pregblank,buy2living,prevtenbuy2,hhregres,hhregresstill,armedforcesspouse,disabled,wheel,income1nk,income1,inc1mort,income2nk,income2,inc2mort,hb,savingsnk,savings,prevown,prevshared,proplen,staircase,stairbought,stairowned,staircasesale,resale,exday,exmonth,exyear,hoday,homonth,hoyear,lanomagr,soctenant,frombeds,fromprop,socprevten,value,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,discount,grant
,completed,,2023-02-08T00:00:00+00:00,2023-02-08T00:00:00+00:00,,2022,1,false,DLUHC,DLUHC,billyboy@eyeklaud.com,8,2,2023,,2,8,,,,1,1,2,1,1,0,,,Address line 1,,Town or city,,SW1A,1AA,1,E09000003,Barnet,1,2,1,30,X,17,17,18,1,1,P,35,X,17,,13,1,1,3,C,14,X,9,X,-9,X,3,R,-9,R,10,,,,,1,1,,,0,,,1,1,1,1,,3,,1,4,5,1,1,0,10000,1,0,10000,1,4,1,,1,2,10,,,,,,,,,,,,,,,,,110000.0,,1,20000.0,5,,10,1,80000.0,,,1,100.0,,10000.0
diff --git a/spec/fixtures/files/sales_logs_csv_export_labels.csv b/spec/fixtures/files/sales_logs_csv_export_labels.csv
index 1a6fd893e..e65065f07 100644
--- a/spec/fixtures/files/sales_logs_csv_export_labels.csv
+++ b/spec/fixtures/files/sales_logs_csv_export_labels.csv
@@ -1,2 +1,2 @@
-id,status,duplicate_log_reference_id,created_at,updated_at,old_form_id,collection_start_year,creation_method,is_dpo,owning_organisation_name,managing_organisation_name,created_by,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,beds,proptype,builtype,pcodenk,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,pcode1,pcode2,la_known,la,la_label,wchair,noint,privacynotice,age1,sex1,ethnic_group,ethnic,national,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationalbuy2,ecstat2,buy2livein,hholdcount,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,prevten,ppcodenk,ppostc1,ppostc2,previous_la_known,prevloc,prevloc_label,pregyrha,pregother,pregla,pregghb,pregblank,buy2living,prevtenbuy2,hhregres,hhregresstill,armedforcesspouse,disabled,wheel,income1nk,income1,inc1mort,income2nk,income2,inc2mort,hb,savingsnk,savings,prevown,prevshared,proplen,staircase,stairbought,stairowned,staircasesale,resale,exday,exmonth,exyear,hoday,homonth,hoyear,lanomagr,soctenant,frombeds,fromprop,socprevten,value,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,discount,grant
+id,status,duplicate_set_id,created_at,updated_at,old_form_id,collection_start_year,creation_method,is_dpo,owning_organisation_name,managing_organisation_name,created_by,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,beds,proptype,builtype,pcodenk,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,pcode1,pcode2,la_known,la,la_label,wchair,noint,privacynotice,age1,sex1,ethnic_group,ethnic,national,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationalbuy2,ecstat2,buy2livein,hholdcount,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,prevten,ppcodenk,ppostc1,ppostc2,previous_la_known,prevloc,prevloc_label,pregyrha,pregother,pregla,pregghb,pregblank,buy2living,prevtenbuy2,hhregres,hhregresstill,armedforcesspouse,disabled,wheel,income1nk,income1,inc1mort,income2nk,income2,inc2mort,hb,savingsnk,savings,prevown,prevshared,proplen,staircase,stairbought,stairowned,staircasesale,resale,exday,exmonth,exyear,hoday,homonth,hoyear,lanomagr,soctenant,frombeds,fromprop,socprevten,value,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,discount,grant
,completed,,2023-02-08T00:00:00+00:00,2023-02-08T00:00:00+00:00,,2022,single log,false,DLUHC,DLUHC,billyboy@eyeklaud.com,8,2,2023,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,Yes,,,Address line 1,,Town or city,,SW1A,1AA,Yes,E09000003,Barnet,Yes,Yes,1,30,Non-binary,Buyer 1 prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,17,,13,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,Child under 16,Other,Not known,Non-binary,"In government training into work, such as New Deal",Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,No,,,No,,,1,1,1,1,,3,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,"Don’t know ",No,,Yes,2,10,,,,,,,,,,,,,,,,,110000.0,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,10000.0
diff --git a/spec/lib/tasks/set_duplicate_references_spec.rb b/spec/lib/tasks/set_duplicate_references_spec.rb
index 05dce0018..9d763ebf8 100644
--- a/spec/lib/tasks/set_duplicate_references_spec.rb
+++ b/spec/lib/tasks/set_duplicate_references_spec.rb
@@ -46,8 +46,8 @@ RSpec.describe "set_duplicate_references" do
expect(sales_log_without_duplicates.duplicates.count).to eq(0)
expect(sales_log_without_duplicates.duplicate_log_references).to be_empty
expect(sales_log.duplicate_log_references.count).to eq(1)
- expect(sales_log.duplicate_log_reference_id).to eq(duplicate_sales_log.duplicate_log_reference_id)
- expect(sales_log.duplicate_log_reference_id).to eq(second_duplicate_sales_log.duplicate_log_reference_id)
+ expect(sales_log.duplicate_set_id).to eq(duplicate_sales_log.duplicate_set_id)
+ expect(sales_log.duplicate_set_id).to eq(second_duplicate_sales_log.duplicate_set_id)
end
it "does not create the references twice" do
@@ -102,7 +102,7 @@ RSpec.describe "set_duplicate_references" do
expect(duplicate_sales_log.duplicate_log_references.count).to eq(1)
expect(sales_log_without_duplicates.duplicates.count).to eq(0)
expect(sales_log_without_duplicates.duplicate_log_references).to be_empty
- expect(sales_log.duplicate_log_reference_id).to eq(duplicate_sales_log.duplicate_log_reference_id)
+ expect(sales_log.duplicate_set_id).to eq(duplicate_sales_log.duplicate_set_id)
expect(other_sales_log.duplicates.count).to eq(1)
expect(other_sales_log.duplicate_log_references.count).to eq(1)
@@ -110,8 +110,8 @@ RSpec.describe "set_duplicate_references" do
expect(other_duplicate_sales_log.duplicate_log_references.count).to eq(1)
expect(other_sales_log_without_duplicates.duplicates.count).to eq(0)
expect(other_sales_log_without_duplicates.duplicate_log_references).to be_empty
- expect(other_sales_log.duplicate_log_reference_id).to eq(other_duplicate_sales_log.duplicate_log_reference_id)
- expect(other_sales_log.duplicate_log_reference_id).not_to eq(sales_log.duplicate_log_reference_id)
+ expect(other_sales_log.duplicate_set_id).to eq(other_duplicate_sales_log.duplicate_set_id)
+ expect(other_sales_log.duplicate_set_id).not_to eq(sales_log.duplicate_set_id)
end
end
@@ -180,8 +180,8 @@ RSpec.describe "set_duplicate_references" do
expect(lettings_log_without_duplicates.duplicates.count).to eq(0)
expect(lettings_log_without_duplicates.duplicate_log_references).to be_empty
expect(lettings_log.duplicate_log_references.count).to eq(1)
- expect(lettings_log.duplicate_log_reference_id).to eq(duplicate_lettings_log.duplicate_log_reference_id)
- expect(lettings_log.duplicate_log_reference_id).to eq(second_duplicate_lettings_log.duplicate_log_reference_id)
+ expect(lettings_log.duplicate_set_id).to eq(duplicate_lettings_log.duplicate_set_id)
+ expect(lettings_log.duplicate_set_id).to eq(second_duplicate_lettings_log.duplicate_set_id)
end
it "does not create the references twice" do
@@ -236,7 +236,7 @@ RSpec.describe "set_duplicate_references" do
expect(duplicate_lettings_log.duplicate_log_references.count).to eq(1)
expect(lettings_log_without_duplicates.duplicates.count).to eq(0)
expect(lettings_log_without_duplicates.duplicate_log_references).to be_empty
- expect(lettings_log.duplicate_log_reference_id).to eq(duplicate_lettings_log.duplicate_log_reference_id)
+ expect(lettings_log.duplicate_set_id).to eq(duplicate_lettings_log.duplicate_set_id)
expect(other_lettings_log.duplicates.count).to eq(1)
expect(other_lettings_log.duplicate_log_references.count).to eq(1)
@@ -244,8 +244,8 @@ RSpec.describe "set_duplicate_references" do
expect(other_duplicate_lettings_log.duplicate_log_references.count).to eq(1)
expect(other_lettings_log_without_duplicates.duplicates.count).to eq(0)
expect(other_lettings_log_without_duplicates.duplicate_log_references).to be_empty
- expect(other_lettings_log.duplicate_log_reference_id).to eq(other_duplicate_lettings_log.duplicate_log_reference_id)
- expect(other_lettings_log.duplicate_log_reference_id).not_to eq(lettings_log.duplicate_log_reference_id)
+ expect(other_lettings_log.duplicate_set_id).to eq(other_duplicate_lettings_log.duplicate_set_id)
+ expect(other_lettings_log.duplicate_set_id).not_to eq(lettings_log.duplicate_set_id)
end
end
diff --git a/spec/models/duplicate_log_reference_spec.rb b/spec/models/duplicate_log_reference_spec.rb
index a92ce7d26..bd149c99f 100644
--- a/spec/models/duplicate_log_reference_spec.rb
+++ b/spec/models/duplicate_log_reference_spec.rb
@@ -2,21 +2,21 @@ require "rails_helper"
RSpec.describe DuplicateLogReference, type: :model do
context "when adding a new duplicate log" do
- context "and duplicate_log_reference_id is not given" do
+ context "and duplicate_set_id is not given" do
let(:sales_log) { create(:sales_log) }
- it "generates a new random duplicate_log_reference_id" do
+ it "generates a new random duplicate_set_id" do
duplicate_log = described_class.create!(log_id: sales_log.id, log_type: "SalesLog")
- expect(duplicate_log.duplicate_log_reference_id).to be_a(Integer)
+ expect(duplicate_log.duplicate_set_id).to be_a(Integer)
end
end
- context "and duplicate_log_reference_id is given" do
+ context "and duplicate_set_id is given" do
let(:sales_log) { create(:sales_log) }
- it "adds correct duplicate_log_reference_id" do
- duplicate_log = described_class.create!(log_id: sales_log.id, log_type: "SalesLog", duplicate_log_reference_id: 123_456)
- expect(duplicate_log.duplicate_log_reference_id).to eq(123_456)
+ it "adds correct duplicate_set_id" do
+ duplicate_log = described_class.create!(log_id: sales_log.id, log_type: "SalesLog", duplicate_set_id: 123_456)
+ expect(duplicate_log.duplicate_set_id).to eq(123_456)
end
end
@@ -49,7 +49,7 @@ RSpec.describe DuplicateLogReference, type: :model do
before do
duplicate_log = described_class.create!(log_id: sales_log.id, log_type: "SalesLog")
- described_class.create!(log_id: other_sales_log.id, log_type: "SalesLog", duplicate_log_reference_id: duplicate_log.duplicate_log_reference_id)
+ described_class.create!(log_id: other_sales_log.id, log_type: "SalesLog", duplicate_set_id: duplicate_log.duplicate_set_id)
create(:sales_log)
create(:sales_log)
end
@@ -75,7 +75,7 @@ RSpec.describe DuplicateLogReference, type: :model do
before do
duplicate_log = described_class.create!(log_id: lettings_log.id, log_type: "LettingsLog")
- described_class.create!(log_id: other_lettings_log.id, log_type: "LettingsLog", duplicate_log_reference_id: duplicate_log.duplicate_log_reference_id)
+ described_class.create!(log_id: other_lettings_log.id, log_type: "LettingsLog", duplicate_set_id: duplicate_log.duplicate_set_id)
create(:lettings_log)
create(:lettings_log)
end
diff --git a/spec/requests/form_controller_spec.rb b/spec/requests/form_controller_spec.rb
index 9512a8f5d..222ada048 100644
--- a/spec/requests/form_controller_spec.rb
+++ b/spec/requests/form_controller_spec.rb
@@ -897,8 +897,8 @@ RSpec.describe FormController, type: :request do
end
before do
- duplicate_log_reference_id = create(:duplicate_log_reference, log_id: lettings_log.id, log_type: "LettingsLog").duplicate_log_reference_id
- create(:duplicate_log_reference, log_id: duplicate_log.id, log_type: "LettingsLog", duplicate_log_reference_id:)
+ duplicate_set_id = create(:duplicate_log_reference, log_id: lettings_log.id, log_type: "LettingsLog").duplicate_set_id
+ create(:duplicate_log_reference, log_id: duplicate_log.id, log_type: "LettingsLog", duplicate_set_id:)
post "/lettings-logs/#{lettings_log.id}/lead-tenant-age", params:, headers: headers.merge({ "HTTP_REFERER" => referrer })
end
@@ -942,8 +942,8 @@ RSpec.describe FormController, type: :request do
end
before do
- duplicate_log_reference_id = create(:duplicate_log_reference, log_id: sales_log.id, log_type: "SalesLog").duplicate_log_reference_id
- create(:duplicate_log_reference, log_id: duplicate_log.id, log_type: "SalesLog", duplicate_log_reference_id:)
+ duplicate_set_id = create(:duplicate_log_reference, log_id: sales_log.id, log_type: "SalesLog").duplicate_set_id
+ create(:duplicate_log_reference, log_id: duplicate_log.id, log_type: "SalesLog", duplicate_set_id:)
post "/sales-logs/#{sales_log.id}/buyer-1-age", params:, headers: headers.merge({ "HTTP_REFERER" => referrer })
end
diff --git a/spec/services/csv/lettings_log_csv_service_spec.rb b/spec/services/csv/lettings_log_csv_service_spec.rb
index 997194361..8d88f471c 100644
--- a/spec/services/csv/lettings_log_csv_service_spec.rb
+++ b/spec/services/csv/lettings_log_csv_service_spec.rb
@@ -114,7 +114,7 @@ RSpec.describe Csv::LettingsLogCsvService do
end
it "adds log attributes not related to questions to the headers" do
- expect(headers.first(5)).to eq %w[id status duplicate_log_reference_id created_by is_dpo]
+ expect(headers.first(5)).to eq %w[id status duplicate_set_id created_by is_dpo]
end
it "adds attributes related to associated schemes and locations to the headers" do
@@ -171,13 +171,13 @@ RSpec.describe Csv::LettingsLogCsvService do
context "when the log has a duplicate log reference" do
before do
- DuplicateLogReference.create!(log_id: log.id, log_type: "LettingsLog", duplicate_log_reference_id: 12_312)
+ DuplicateLogReference.create!(log_id: log.id, log_type: "LettingsLog", duplicate_set_id: 12_312)
end
- it "exports the id for under the heading 'duplicate_log_reference_id'" do
- duplicate_log_reference_id_column_index = csv.first.index("duplicate_log_reference_id")
- duplicate_log_reference_id_value = csv.second[duplicate_log_reference_id_column_index]
- expect(duplicate_log_reference_id_value).to eq "12312"
+ it "exports the id for under the heading 'duplicate_set_id'" do
+ duplicate_set_id_column_index = csv.first.index("duplicate_set_id")
+ duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
+ expect(duplicate_set_id_value).to eq "12312"
end
end
end
@@ -256,13 +256,13 @@ RSpec.describe Csv::LettingsLogCsvService do
context "when the log has a duplicate log reference" do
before do
- DuplicateLogReference.create!(log_id: log.id, log_type: "LettingsLog", duplicate_log_reference_id: 12_312)
+ DuplicateLogReference.create!(log_id: log.id, log_type: "LettingsLog", duplicate_set_id: 12_312)
end
- it "exports the id for under the heading 'duplicate_log_reference_id'" do
- duplicate_log_reference_id_column_index = csv.first.index("duplicate_log_reference_id")
- duplicate_log_reference_id_value = csv.second[duplicate_log_reference_id_column_index]
- expect(duplicate_log_reference_id_value).to eq "12312"
+ it "exports the id for under the heading 'duplicate_set_id'" do
+ duplicate_set_id_column_index = csv.first.index("duplicate_set_id")
+ duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
+ expect(duplicate_set_id_value).to eq "12312"
end
end
end
diff --git a/spec/services/csv/sales_log_csv_service_spec.rb b/spec/services/csv/sales_log_csv_service_spec.rb
index fcc04f630..e60321365 100644
--- a/spec/services/csv/sales_log_csv_service_spec.rb
+++ b/spec/services/csv/sales_log_csv_service_spec.rb
@@ -166,13 +166,13 @@ RSpec.describe Csv::SalesLogCsvService do
context "when the log has a duplicate log reference" do
before do
- DuplicateLogReference.create!(log_id: log.id, log_type: "SalesLog", duplicate_log_reference_id: 12_312)
+ DuplicateLogReference.create!(log_id: log.id, log_type: "SalesLog", duplicate_set_id: 12_312)
end
- it "exports the id for under the heading 'duplicate_log_reference_id'" do
- duplicate_log_reference_id_column_index = csv.first.index("duplicate_log_reference_id")
- duplicate_log_reference_id_value = csv.second[duplicate_log_reference_id_column_index]
- expect(duplicate_log_reference_id_value).to eq "12312"
+ it "exports the id for under the heading 'duplicate_set_id'" do
+ duplicate_set_id_column_index = csv.first.index("duplicate_set_id")
+ duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
+ expect(duplicate_set_id_value).to eq "12312"
end
end
end
@@ -226,13 +226,13 @@ RSpec.describe Csv::SalesLogCsvService do
context "when the log has a duplicate log reference" do
before do
- DuplicateLogReference.create!(log_id: log.id, log_type: "SalesLog", duplicate_log_reference_id: 12_312)
+ DuplicateLogReference.create!(log_id: log.id, log_type: "SalesLog", duplicate_set_id: 12_312)
end
- it "exports the id for under the heading 'duplicate_log_reference_id'" do
- duplicate_log_reference_id_column_index = csv.first.index("duplicate_log_reference_id")
- duplicate_log_reference_id_value = csv.second[duplicate_log_reference_id_column_index]
- expect(duplicate_log_reference_id_value).to eq "12312"
+ it "exports the id for under the heading 'duplicate_set_id'" do
+ duplicate_set_id_column_index = csv.first.index("duplicate_set_id")
+ duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
+ expect(duplicate_set_id_value).to eq "12312"
end
end
end
diff --git a/spec/services/exports/lettings_log_export_service_spec.rb b/spec/services/exports/lettings_log_export_service_spec.rb
index 6162af3b2..3134237ec 100644
--- a/spec/services/exports/lettings_log_export_service_spec.rb
+++ b/spec/services/exports/lettings_log_export_service_spec.rb
@@ -418,16 +418,16 @@ RSpec.describe Exports::LettingsLogExportService do
let!(:lettings_log) { FactoryBot.create(:lettings_log, :completed, created_by: user, propcode: "123", ppostcode_full: "SE2 6RT", postcode_full: "NW1 5TY", tenancycode: "BZ737", startdate: Time.zone.local(2022, 2, 2, 10, 36, 49), voiddate: Time.zone.local(2019, 11, 3), mrcdate: Time.zone.local(2020, 5, 5, 10, 36, 49), tenancylength: 5, underoccupation_benefitcap: 4) }
before do
- FactoryBot.create(:duplicate_log_reference, log_type: "LettingsLog", log_id: lettings_log.id, duplicate_log_reference_id: 123)
+ FactoryBot.create(:duplicate_log_reference, log_type: "LettingsLog", log_id: lettings_log.id, duplicate_set_id: 123)
end
- def replace_duplicate_log_reference_id(export_file)
- export_file.sub!("", "123")
+ def replace_duplicate_set_id(export_file)
+ export_file.sub!("", "123")
end
it "generates an XML export file with the expected content within the ZIP file" do
expected_content = replace_entity_ids(lettings_log, xml_export_file.read)
- expected_content = replace_duplicate_log_reference_id(expected_content)
+ expected_content = replace_duplicate_set_id(expected_content)
expect(storage_service).to receive(:write_file).with(expected_zip_filename, any_args) do |_, content|
entry = Zip::File.open_buffer(content).find_entry(expected_data_filename)
expect(entry).not_to be_nil