Browse Source

CLDC-3367 Rename sales support CSV fields (#2413)

* Rename sales support CSV fields

* Update sales CSV user fields order (#2416)
pull/2410/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
a560d6e818
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 73
      app/services/csv/sales_log_csv_service.rb
  2. 4
      spec/fixtures/files/sales_logs_csv_export_codes_23.csv
  3. 4
      spec/fixtures/files/sales_logs_csv_export_codes_24.csv
  4. 4
      spec/fixtures/files/sales_logs_csv_export_labels_23.csv
  5. 4
      spec/fixtures/files/sales_logs_csv_export_labels_24.csv
  6. 52
      spec/services/csv/sales_log_csv_service_spec.rb

73
app/services/csv/sales_log_csv_service.rb

@ -9,7 +9,7 @@ module Csv
def prepare_csv(logs)
CSV.generate(headers: true) do |csv|
csv << @attributes
csv << formatted_attribute_headers
logs.find_each do |log|
csv << @attributes.map { |attribute| value(attribute, log) }
@ -139,7 +139,7 @@ module Csv
"ppostcode_full" => %w[ppostc1 ppostc2],
"la" => %w[la la_label],
"prevloc" => %w[prevloc prevloc_label],
"assigned_to_id" => %w[assigned_to],
"assigned_to_id" => %w[created_by assigned_to],
"owning_organisation_id" => %w[owning_organisation_name],
"managing_organisation_id" => %w[managing_organisation_name],
"value" => %w[value value_value_check],
@ -153,6 +153,59 @@ module Csv
SUPPORT_ONLY_ATTRIBUTES = %w[address_line1_as_entered address_line2_as_entered town_or_city_as_entered county_as_entered postcode_full_as_entered la_as_entered created_by value_value_check mscharge_value_check].freeze
SUPPORT_ATTRIBUTE_NAME_MAPPINGS = {
"duplicate_set_id" => "DUPLICATESET",
"bulk_upload_id" => "BULKUPLOADID",
"created_at" => "CREATEDDATE",
"updated_at" => "UPLOADDATE",
"old_form_id" => "FORM",
"collection_start_year" => "COLLECTIONYEAR",
"creation_method" => "CREATIONMETHOD",
"is_dpo" => "DATAPROTECT",
"created_by" => "CREATEDBY",
"owning_organisation_name" => "OWNINGORGNAME",
"managing_organisation_name" => "MANINGORGNAME",
"assigned_to" => "USERNAME",
"ownershipsch" => "OWNERSHIP",
"companybuy" => "COMPANY",
"buylivein" => "LIVEINBUYER",
"jointpur" => "JOINT",
"address_line1" => "ADDRESS1",
"address_line2" => "ADDRESS2",
"town_or_city" => "TOWNCITY",
"postcode_full" => "POSTCODE",
"is_la_inferred" => "ISLAINFERRED",
"la_label" => "LANAME",
"uprn_selection" => "UPRNSELECTED",
"address_line1_input" => "ADDRESS1INPUT",
"postcode_full_input" => "POSTCODEINPUT",
"address_line1_as_entered" => "BULKADDRESS1",
"address_line2_as_entered" => "BULKADDRESS2",
"town_or_city_as_entered" => "BULKTOWNCITY",
"county_as_entered" => "BULKCOUNTY",
"postcode_full_as_entered" => "BULKPOSTCODE",
"la_as_entered" => "BULKLA",
"ethnic_group" => "ETHNICGROUP1",
"nationality_all" => "NATIONALITYALL1",
"buy1livein" => "LIVEINBUYER1",
"ethnic_group2" => "ETHNICGROUP2",
"ethnicbuy2" => "ETHNIC2",
"nationality_all_buyer2" => "NATIONALITYALL2",
"buy2livein" => "LIVEINBUYER2",
"hholdcount" => "HHTYPE",
"previous_la_known" => "PREVIOUSLAKNOWN",
"prevloc_label" => "PREVLOCNAME",
"prevtenbuy2" => "PREVTEN2",
"income1nk" => "INC1NK",
"income2nk" => "INC2NK",
"staircasesale" => "STAIRCASETOSALE",
"soctenant" => "SOCTEN",
"mortlen" => "MORTLEN1",
"has_mscharge" => "HASMSCHARGE",
"nationalbuy2" => "NATIONAL2",
"uprn_confirmed" => "UPRNCONFIRMED",
}.freeze
def sales_log_attributes
ordered_questions = FormHandler.instance.ordered_questions_for_year(@year, "sales")
ordered_questions.reject! { |q| q.id.match?(/((?<!la)_known)|(_check)|(_asked)|nationality_all_group|nationality_all_buyer2_group/) }
@ -189,18 +242,26 @@ module Csv
def non_question_fields
case @year
when 2022
%w[id status created_at updated_at old_form_id collection_start_year creation_method is_dpo created_by]
%w[id status created_at updated_at old_form_id collection_start_year creation_method is_dpo]
when 2023
%w[id status duplicate_set_id created_at updated_at old_form_id collection_start_year creation_method is_dpo created_by]
%w[id status duplicate_set_id created_at updated_at old_form_id collection_start_year creation_method is_dpo]
when 2024
%w[id status duplicate_set_id created_at updated_at collection_start_year creation_method bulk_upload_id is_dpo created_by]
%w[id status duplicate_set_id created_at updated_at collection_start_year creation_method bulk_upload_id is_dpo]
else
%w[id status duplicate_set_id created_at updated_at collection_start_year creation_method bulk_upload_id is_dpo created_by]
%w[id status duplicate_set_id created_at updated_at collection_start_year creation_method bulk_upload_id is_dpo]
end
end
def all_address_fields
ORDERED_ADDRESS_FIELDS + %w[uprn_confirmed]
end
def formatted_attribute_headers
return @attributes unless @user.support?
@attributes.map do |attribute|
SUPPORT_ATTRIBUTE_NAME_MAPPINGS[attribute] || attribute.upcase
end
end
end
end

4
spec/fixtures/files/sales_logs_csv_export_codes_23.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_at,updated_at,old_form_id,collection_start_year,creation_method,is_dpo,created_by,owning_organisation_name,managing_organisation_name,assigned_to,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,beds,proptype,builtype,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,pcode1,pcode2,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,value_value_check,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,mscharge_value_check,discount,grant
,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,1,false,billyboy@eyeklaud.com,DLUHC,DLUHC,billyboy@eyeklaud.com,8,12,2023,,2,8,,,,1,1,2,1,1,,,Address line 1,,Town or city,,SW1A,1AA,E09000003,Barnet,1,2,1,30,X,17,17,18,1,1,P,35,X,17,,13,1,1,3,C,14,X,,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
ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT
,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,1,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,2,8,,,,1,1,2,1,1,,,Address line 1,,Town or city,,SW1A,1AA,E09000003,Barnet,1,2,1,30,X,17,17,18,1,1,P,35,X,17,,13,1,1,3,C,14,X,,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

1 id ID status STATUS duplicate_set_id DUPLICATESET created_at CREATEDDATE updated_at UPLOADDATE old_form_id FORM collection_start_year COLLECTIONYEAR creation_method CREATIONMETHOD is_dpo DATAPROTECT created_by OWNINGORGNAME owning_organisation_name MANINGORGNAME managing_organisation_name CREATEDBY assigned_to USERNAME day DAY month MONTH year YEAR purchid PURCHID ownershipsch OWNERSHIP type TYPE othtype OTHTYPE companybuy COMPANY buylivein LIVEINBUYER jointpur JOINT jointmore JOINTMORE beds BEDS proptype PROPTYPE builtype BUILTYPE uprn UPRN uprn_confirmed UPRNCONFIRMED address_line1 ADDRESS1 address_line2 ADDRESS2 town_or_city TOWNCITY county COUNTY pcode1 PCODE1 pcode2 PCODE2 la LA la_label LANAME wchair WCHAIR noint NOINT privacynotice PRIVACYNOTICE age1 AGE1 sex1 SEX1 ethnic_group ETHNICGROUP1 ethnic ETHNIC national NATIONAL ecstat1 ECSTAT1 buy1livein LIVEINBUYER1 relat2 RELAT2 age2 AGE2 sex2 SEX2 ethnic_group2 ETHNICGROUP2 ethnicbuy2 ETHNIC2 nationalbuy2 NATIONAL2 ecstat2 ECSTAT2 buy2livein LIVEINBUYER2 hholdcount HHTYPE relat3 RELAT3 age3 AGE3 sex3 SEX3 ecstat3 ECSTAT3 relat4 RELAT4 age4 AGE4 sex4 SEX4 ecstat4 ECSTAT4 relat5 RELAT5 age5 AGE5 sex5 SEX5 ecstat5 ECSTAT5 relat6 RELAT6 age6 AGE6 sex6 SEX6 ecstat6 ECSTAT6 prevten PREVTEN ppcodenk PPCODENK ppostc1 PPOSTC1 ppostc2 PPOSTC2 previous_la_known PREVIOUSLAKNOWN prevloc PREVLOC prevloc_label PREVLOCNAME pregyrha PREGYRHA pregother PREGOTHER pregla PREGLA pregghb PREGGHB pregblank PREGBLANK buy2living BUY2LIVING prevtenbuy2 PREVTEN2 hhregres HHREGRES hhregresstill HHREGRESSTILL armedforcesspouse ARMEDFORCESSPOUSE disabled DISABLED wheel WHEEL income1nk INC1NK income1 INCOME1 inc1mort INC1MORT income2nk INC2NK income2 INCOME2 inc2mort INC2MORT hb HB savingsnk SAVINGSNK savings SAVINGS prevown PREVOWN prevshared PREVSHARED proplen PROPLEN staircase STAIRCASE stairbought STAIRBOUGHT stairowned STAIROWNED staircasesale STAIRCASETOSALE resale RESALE exday EXDAY exmonth EXMONTH exyear EXYEAR hoday HODAY homonth HOMONTH hoyear HOYEAR lanomagr LANOMAGR soctenant SOCTEN frombeds FROMBEDS fromprop FROMPROP socprevten SOCPREVTEN value VALUE value_value_check VALUE_VALUE_CHECK equity EQUITY mortgageused MORTGAGEUSED mortgage MORTGAGE mortgagelender MORTGAGELENDER mortgagelenderother MORTGAGELENDEROTHER mortlen MORTLEN1 extrabor EXTRABOR deposit DEPOSIT cashdis CASHDIS mrent MRENT has_mscharge HASMSCHARGE mscharge MSCHARGE mscharge_value_check MSCHARGE_VALUE_CHECK discount DISCOUNT grant GRANT
2 completed completed 2023-12-08T00:00:00+00:00 2023-12-08T00:00:00+00:00 2024-01-01T00:00:00+00:00 2024-01-01T00:00:00+00:00 2023 2023 1 1 false false billyboy@eyeklaud.com DLUHC DLUHC DLUHC DLUHC billyboy@eyeklaud.com billyboy@eyeklaud.com billyboy@eyeklaud.com 8 8 12 12 2023 2023 2 2 8 8 1 1 1 1 2 2 1 1 1 1 Address line 1 Address line 1 Town or city Town or city SW1A SW1A 1AA 1AA E09000003 E09000003 Barnet Barnet 1 1 2 2 1 1 30 30 X X 17 17 17 17 18 18 1 1 1 1 P P 35 35 X X 17 17 13 13 1 1 1 1 3 3 C C 14 14 X X X X -9 -9 X X 3 3 R R -9 -9 R R 10 10 1 1 1 1 0 0 1 1 1 1 1 1 1 1 3 3 1 1 4 4 5 5 1 1 1 1 0 0 10000 10000 1 1 0 0 10000 10000 1 1 4 4 1 1 1 1 2 2 10 10 110000.0 110000.0 1 1 20000.0 20000.0 5 5 10 10 1 1 80000.0 80000.0 1 1 100.0 100.0 10000.0 10000.0

4
spec/fixtures/files/sales_logs_csv_export_codes_24.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_at,updated_at,collection_start_year,creation_method,bulk_upload_id,is_dpo,created_by,owning_organisation_name,managing_organisation_name,assigned_to,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,noint,privacynotice,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,beds,proptype,builtype,wchair,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationality_all_buyer2,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,value_value_check,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,mscharge_value_check,discount,grant
,in_progress,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,1,,false,billyboy@eyeklaud.com,DLUHC,DLUHC,billyboy@eyeklaud.com,1,5,2024,,2,8,,,,1,1,2,1,,Address line 1,,Town or city,,SW1A 1AA,false,Barnet,E09000003,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,1,1,1,30,X,17,17,,1,1,P,35,X,17,,,1,1,3,C,14,X,9,X,-9,X,3,R,-9,R,10,,,,,1,0,SW1A,1AA,1,E09000003,Barnet,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
ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT
,in_progress,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,1,,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,2,8,,,,1,1,2,1,,Address line 1,,Town or city,,SW1A 1AA,false,Barnet,E09000003,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,1,1,1,30,X,17,17,,1,1,P,35,X,17,,,1,1,3,C,14,X,9,X,-9,X,3,R,-9,R,10,,,,,1,0,SW1A,1AA,1,E09000003,Barnet,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

1 id ID status STATUS duplicate_set_id DUPLICATESET created_at CREATEDDATE updated_at UPLOADDATE collection_start_year COLLECTIONYEAR creation_method CREATIONMETHOD bulk_upload_id BULKUPLOADID is_dpo DATAPROTECT created_by OWNINGORGNAME owning_organisation_name MANINGORGNAME managing_organisation_name CREATEDBY assigned_to USERNAME day DAY month MONTH year YEAR purchid PURCHID ownershipsch OWNERSHIP type TYPE othtype OTHTYPE companybuy COMPANY buylivein LIVEINBUYER jointpur JOINT jointmore JOINTMORE noint NOINT privacynotice PRIVACYNOTICE uprn UPRN address_line1 ADDRESS1 address_line2 ADDRESS2 town_or_city TOWNCITY county COUNTY postcode_full POSTCODE is_la_inferred ISLAINFERRED la_label LANAME la LA uprn_selection UPRNSELECTED address_search_value_check ADDRESS_SEARCH_VALUE_CHECK address_line1_input ADDRESS1INPUT postcode_full_input POSTCODEINPUT address_line1_as_entered BULKADDRESS1 address_line2_as_entered BULKADDRESS2 town_or_city_as_entered BULKTOWNCITY county_as_entered BULKCOUNTY postcode_full_as_entered BULKPOSTCODE la_as_entered BULKLA beds BEDS proptype PROPTYPE builtype BUILTYPE wchair WCHAIR age1 AGE1 sex1 SEX1 ethnic_group ETHNICGROUP1 ethnic ETHNIC nationality_all NATIONALITYALL1 ecstat1 ECSTAT1 buy1livein LIVEINBUYER1 relat2 RELAT2 age2 AGE2 sex2 SEX2 ethnic_group2 ETHNICGROUP2 ethnicbuy2 ETHNIC2 nationality_all_buyer2 NATIONALITYALL2 ecstat2 ECSTAT2 buy2livein LIVEINBUYER2 hholdcount HHTYPE relat3 RELAT3 age3 AGE3 sex3 SEX3 ecstat3 ECSTAT3 relat4 RELAT4 age4 AGE4 sex4 SEX4 ecstat4 ECSTAT4 relat5 RELAT5 age5 AGE5 sex5 SEX5 ecstat5 ECSTAT5 relat6 RELAT6 age6 AGE6 sex6 SEX6 ecstat6 ECSTAT6 prevten PREVTEN ppcodenk PPCODENK ppostc1 PPOSTC1 ppostc2 PPOSTC2 previous_la_known PREVIOUSLAKNOWN prevloc PREVLOC prevloc_label PREVLOCNAME pregyrha PREGYRHA pregother PREGOTHER pregla PREGLA pregghb PREGGHB pregblank PREGBLANK buy2living BUY2LIVING prevtenbuy2 PREVTEN2 hhregres HHREGRES hhregresstill HHREGRESSTILL armedforcesspouse ARMEDFORCESSPOUSE disabled DISABLED wheel WHEEL income1nk INC1NK income1 INCOME1 inc1mort INC1MORT income2nk INC2NK income2 INCOME2 inc2mort INC2MORT hb HB savingsnk SAVINGSNK savings SAVINGS prevown PREVOWN prevshared PREVSHARED proplen PROPLEN staircase STAIRCASE stairbought STAIRBOUGHT stairowned STAIROWNED staircasesale STAIRCASETOSALE resale RESALE exday EXDAY exmonth EXMONTH exyear EXYEAR hoday HODAY homonth HOMONTH hoyear HOYEAR lanomagr LANOMAGR soctenant SOCTEN frombeds FROMBEDS fromprop FROMPROP socprevten SOCPREVTEN value VALUE value_value_check VALUE_VALUE_CHECK equity EQUITY mortgageused MORTGAGEUSED mortgage MORTGAGE mortgagelender MORTGAGELENDER mortgagelenderother MORTGAGELENDEROTHER mortlen MORTLEN1 extrabor EXTRABOR deposit DEPOSIT cashdis CASHDIS mrent MRENT has_mscharge HASMSCHARGE mscharge MSCHARGE mscharge_value_check MSCHARGE_VALUE_CHECK discount DISCOUNT grant GRANT
2 in_progress in_progress 2024-05-01T00:00:00+01:00 2024-05-01T00:00:00+01:00 2024-05-01T00:00:00+01:00 2024-05-01T00:00:00+01:00 2024 2024 1 1 false false billyboy@eyeklaud.com DLUHC DLUHC DLUHC DLUHC billyboy@eyeklaud.com billyboy@eyeklaud.com billyboy@eyeklaud.com 1 1 5 5 2024 2024 2 2 8 8 1 1 1 1 2 2 1 1 Address line 1 Address line 1 Town or city Town or city SW1A 1AA SW1A 1AA false false Barnet Barnet E09000003 E09000003 address line 1 as entered address line 1 as entered address line 2 as entered address line 2 as entered town or city as entered town or city as entered county as entered county as entered AB1 2CD AB1 2CD la as entered la as entered 2 2 1 1 1 1 1 1 30 30 X X 17 17 17 17 1 1 1 1 P P 35 35 X X 17 17 1 1 1 1 3 3 C C 14 14 X X 9 9 X X -9 -9 X X 3 3 R R -9 -9 R R 10 10 1 1 0 0 SW1A SW1A 1AA 1AA 1 1 E09000003 E09000003 Barnet Barnet 1 1 1 1 1 1 1 1 3 3 1 1 4 4 5 5 1 1 1 1 0 0 10000 10000 1 1 0 0 10000 10000 1 1 4 4 1 1 1 1 2 2 10 10 110000.0 110000.0 1 1 20000.0 20000.0 5 5 10 10 1 1 80000.0 80000.0 1 1 100.0 100.0 10000.0 10000.0

4
spec/fixtures/files/sales_logs_csv_export_labels_23.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_at,updated_at,old_form_id,collection_start_year,creation_method,is_dpo,created_by,owning_organisation_name,managing_organisation_name,assigned_to,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,beds,proptype,builtype,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,pcode1,pcode2,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,value_value_check,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,mscharge_value_check,discount,grant
,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,single log,false,billyboy@eyeklaud.com,DLUHC,DLUHC,billyboy@eyeklaud.com,8,12,2023,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,,,Address line 1,,Town or city,,SW1A,1AA,E09000003,Barnet,Yes,Yes,1,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,Buyer prefers not to say,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,No,,,No,,,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0
ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,FORM,COLLECTIONYEAR,CREATIONMETHOD,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,BEDS,PROPTYPE,BUILTYPE,UPRN,UPRNCONFIRMED,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,PCODE1,PCODE2,LA,LANAME,WCHAIR,NOINT,PRIVACYNOTICE,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONAL,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONAL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT
,completed,,2023-12-08T00:00:00+00:00,2024-01-01T00:00:00+00:00,,2023,single log,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,8,12,2023,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,2,Flat or maisonette,Purpose built,,,Address line 1,,Town or city,,SW1A,1AA,E09000003,Barnet,Yes,Yes,1,30,Non-binary,Buyer prefers not to say,17,United Kingdom,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,Buyer prefers not to say,Full-time - 30 hours or more,Yes,3,Child,14,Non-binary,,Other,Not known,Non-binary,In government training into work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,No,,,No,,,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0

1 id ID status STATUS duplicate_set_id DUPLICATESET created_at CREATEDDATE updated_at UPLOADDATE old_form_id FORM collection_start_year COLLECTIONYEAR creation_method CREATIONMETHOD is_dpo DATAPROTECT created_by OWNINGORGNAME owning_organisation_name MANINGORGNAME managing_organisation_name CREATEDBY assigned_to USERNAME day DAY month MONTH year YEAR purchid PURCHID ownershipsch OWNERSHIP type TYPE othtype OTHTYPE companybuy COMPANY buylivein LIVEINBUYER jointpur JOINT jointmore JOINTMORE beds BEDS proptype PROPTYPE builtype BUILTYPE uprn UPRN uprn_confirmed UPRNCONFIRMED address_line1 ADDRESS1 address_line2 ADDRESS2 town_or_city TOWNCITY county COUNTY pcode1 PCODE1 pcode2 PCODE2 la LA la_label LANAME wchair WCHAIR noint NOINT privacynotice PRIVACYNOTICE age1 AGE1 sex1 SEX1 ethnic_group ETHNICGROUP1 ethnic ETHNIC national NATIONAL ecstat1 ECSTAT1 buy1livein LIVEINBUYER1 relat2 RELAT2 age2 AGE2 sex2 SEX2 ethnic_group2 ETHNICGROUP2 ethnicbuy2 ETHNIC2 nationalbuy2 NATIONAL2 ecstat2 ECSTAT2 buy2livein LIVEINBUYER2 hholdcount HHTYPE relat3 RELAT3 age3 AGE3 sex3 SEX3 ecstat3 ECSTAT3 relat4 RELAT4 age4 AGE4 sex4 SEX4 ecstat4 ECSTAT4 relat5 RELAT5 age5 AGE5 sex5 SEX5 ecstat5 ECSTAT5 relat6 RELAT6 age6 AGE6 sex6 SEX6 ecstat6 ECSTAT6 prevten PREVTEN ppcodenk PPCODENK ppostc1 PPOSTC1 ppostc2 PPOSTC2 previous_la_known PREVIOUSLAKNOWN prevloc PREVLOC prevloc_label PREVLOCNAME pregyrha PREGYRHA pregother PREGOTHER pregla PREGLA pregghb PREGGHB pregblank PREGBLANK buy2living BUY2LIVING prevtenbuy2 PREVTEN2 hhregres HHREGRES hhregresstill HHREGRESSTILL armedforcesspouse ARMEDFORCESSPOUSE disabled DISABLED wheel WHEEL income1nk INC1NK income1 INCOME1 inc1mort INC1MORT income2nk INC2NK income2 INCOME2 inc2mort INC2MORT hb HB savingsnk SAVINGSNK savings SAVINGS prevown PREVOWN prevshared PREVSHARED proplen PROPLEN staircase STAIRCASE stairbought STAIRBOUGHT stairowned STAIROWNED staircasesale STAIRCASETOSALE resale RESALE exday EXDAY exmonth EXMONTH exyear EXYEAR hoday HODAY homonth HOMONTH hoyear HOYEAR lanomagr LANOMAGR soctenant SOCTEN frombeds FROMBEDS fromprop FROMPROP socprevten SOCPREVTEN value VALUE value_value_check VALUE_VALUE_CHECK equity EQUITY mortgageused MORTGAGEUSED mortgage MORTGAGE mortgagelender MORTGAGELENDER mortgagelenderother MORTGAGELENDEROTHER mortlen MORTLEN1 extrabor EXTRABOR deposit DEPOSIT cashdis CASHDIS mrent MRENT has_mscharge HASMSCHARGE mscharge MSCHARGE mscharge_value_check MSCHARGE_VALUE_CHECK discount DISCOUNT grant GRANT
2 completed completed 2023-12-08T00:00:00+00:00 2023-12-08T00:00:00+00:00 2024-01-01T00:00:00+00:00 2024-01-01T00:00:00+00:00 2023 2023 single log single log false false billyboy@eyeklaud.com DLUHC DLUHC DLUHC DLUHC billyboy@eyeklaud.com billyboy@eyeklaud.com billyboy@eyeklaud.com 8 8 12 12 2023 2023 Yes - a discounted ownership scheme Yes - a discounted ownership scheme Right to Acquire (RTA) Right to Acquire (RTA) Yes Yes Yes Yes 2 2 Flat or maisonette Flat or maisonette Purpose built Purpose built Address line 1 Address line 1 Town or city Town or city SW1A SW1A 1AA 1AA E09000003 E09000003 Barnet Barnet Yes Yes Yes Yes 1 1 30 30 Non-binary Non-binary Buyer prefers not to say Buyer prefers not to say 17 17 United Kingdom United Kingdom Full-time - 30 hours or more Full-time - 30 hours or more Yes Yes Partner Partner 35 35 Non-binary Non-binary Buyer prefers not to say Buyer prefers not to say Buyer prefers not to say Buyer prefers not to say Full-time - 30 hours or more Full-time - 30 hours or more Yes Yes 3 3 Child Child 14 14 Non-binary Non-binary Other Other Not known Not known Non-binary Non-binary In government training into work In government training into work Prefers not to say Prefers not to say Not known Not known Prefers not to say Prefers not to say Prefers not to say Prefers not to say Local authority tenant Local authority tenant No No No No 1 1 1 1 1 1 1 1 Don't know Don't know Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes 10000 10000 Yes Yes Yes Yes 10000 10000 Yes Yes Don’t know Don’t know No No Yes Yes No No 10 10 110000.0 110000.0 Yes Yes 20000.0 20000.0 Cambridge Building Society Cambridge Building Society 10 10 Yes Yes 80000.0 80000.0 Yes Yes 100.0 100.0 10000.0 10000.0

4
spec/fixtures/files/sales_logs_csv_export_labels_24.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_at,updated_at,collection_start_year,creation_method,bulk_upload_id,is_dpo,created_by,owning_organisation_name,managing_organisation_name,assigned_to,day,month,year,purchid,ownershipsch,type,othtype,companybuy,buylivein,jointpur,jointmore,noint,privacynotice,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,beds,proptype,builtype,wchair,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,buy1livein,relat2,age2,sex2,ethnic_group2,ethnicbuy2,nationality_all_buyer2,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,value_value_check,equity,mortgageused,mortgage,mortgagelender,mortgagelenderother,mortlen,extrabor,deposit,cashdis,mrent,has_mscharge,mscharge,mscharge_value_check,discount,grant
,in_progress,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,billyboy@eyeklaud.com,DLUHC,DLUHC,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,,Address line 1,,Town or city,,SW1A 1AA,No,Barnet,E09000003,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,Australia,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,,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,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,SW1A,1AA,Yes,E09000003,Barnet,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0
ID,STATUS,DUPLICATESET,CREATEDDATE,UPLOADDATE,COLLECTIONYEAR,CREATIONMETHOD,BULKUPLOADID,DATAPROTECT,OWNINGORGNAME,MANINGORGNAME,CREATEDBY,USERNAME,DAY,MONTH,YEAR,PURCHID,OWNERSHIP,TYPE,OTHTYPE,COMPANY,LIVEINBUYER,JOINT,JOINTMORE,NOINT,PRIVACYNOTICE,UPRN,ADDRESS1,ADDRESS2,TOWNCITY,COUNTY,POSTCODE,ISLAINFERRED,LANAME,LA,UPRNSELECTED,ADDRESS_SEARCH_VALUE_CHECK,ADDRESS1INPUT,POSTCODEINPUT,BULKADDRESS1,BULKADDRESS2,BULKTOWNCITY,BULKCOUNTY,BULKPOSTCODE,BULKLA,BEDS,PROPTYPE,BUILTYPE,WCHAIR,AGE1,SEX1,ETHNICGROUP1,ETHNIC,NATIONALITYALL1,ECSTAT1,LIVEINBUYER1,RELAT2,AGE2,SEX2,ETHNICGROUP2,ETHNIC2,NATIONALITYALL2,ECSTAT2,LIVEINBUYER2,HHTYPE,RELAT3,AGE3,SEX3,ECSTAT3,RELAT4,AGE4,SEX4,ECSTAT4,RELAT5,AGE5,SEX5,ECSTAT5,RELAT6,AGE6,SEX6,ECSTAT6,PREVTEN,PPCODENK,PPOSTC1,PPOSTC2,PREVIOUSLAKNOWN,PREVLOC,PREVLOCNAME,PREGYRHA,PREGOTHER,PREGLA,PREGGHB,PREGBLANK,BUY2LIVING,PREVTEN2,HHREGRES,HHREGRESSTILL,ARMEDFORCESSPOUSE,DISABLED,WHEEL,INC1NK,INCOME1,INC1MORT,INC2NK,INCOME2,INC2MORT,HB,SAVINGSNK,SAVINGS,PREVOWN,PREVSHARED,PROPLEN,STAIRCASE,STAIRBOUGHT,STAIROWNED,STAIRCASETOSALE,RESALE,EXDAY,EXMONTH,EXYEAR,HODAY,HOMONTH,HOYEAR,LANOMAGR,SOCTEN,FROMBEDS,FROMPROP,SOCPREVTEN,VALUE,VALUE_VALUE_CHECK,EQUITY,MORTGAGEUSED,MORTGAGE,MORTGAGELENDER,MORTGAGELENDEROTHER,MORTLEN1,EXTRABOR,DEPOSIT,CASHDIS,MRENT,HASMSCHARGE,MSCHARGE,MSCHARGE_VALUE_CHECK,DISCOUNT,GRANT
,in_progress,,2024-05-01T00:00:00+01:00,2024-05-01T00:00:00+01:00,2024,single log,,false,DLUHC,DLUHC,billyboy@eyeklaud.com,billyboy@eyeklaud.com,1,5,2024,,Yes - a discounted ownership scheme,Right to Acquire (RTA),,,,Yes,Yes,Yes,1,,Address line 1,,Town or city,,SW1A 1AA,No,Barnet,E09000003,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,2,Flat or maisonette,Purpose built,Yes,30,Non-binary,Buyer prefers not to say,17,Australia,Full-time - 30 hours or more,Yes,Partner,35,Non-binary,Buyer prefers not to say,,,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,Prefers not to say,Not known,Prefers not to say,Prefers not to say,,,,,Local authority tenant,Yes,SW1A,1AA,Yes,E09000003,Barnet,1,1,1,1,,Don't know,,Yes,Yes,No,Yes,Yes,Yes,10000,Yes,Yes,10000,Yes,Don’t know ,No,,Yes,No,10,,,,,,,,,,,,,,,,,110000.0,,,Yes,20000.0,Cambridge Building Society,,10,Yes,80000.0,,,Yes,100.0,,,10000.0

1 id ID status STATUS duplicate_set_id DUPLICATESET created_at CREATEDDATE updated_at UPLOADDATE collection_start_year COLLECTIONYEAR creation_method CREATIONMETHOD bulk_upload_id BULKUPLOADID is_dpo DATAPROTECT created_by OWNINGORGNAME owning_organisation_name MANINGORGNAME managing_organisation_name CREATEDBY assigned_to USERNAME day DAY month MONTH year YEAR purchid PURCHID ownershipsch OWNERSHIP type TYPE othtype OTHTYPE companybuy COMPANY buylivein LIVEINBUYER jointpur JOINT jointmore JOINTMORE noint NOINT privacynotice PRIVACYNOTICE uprn UPRN address_line1 ADDRESS1 address_line2 ADDRESS2 town_or_city TOWNCITY county COUNTY postcode_full POSTCODE is_la_inferred ISLAINFERRED la_label LANAME la LA uprn_selection UPRNSELECTED address_search_value_check ADDRESS_SEARCH_VALUE_CHECK address_line1_input ADDRESS1INPUT postcode_full_input POSTCODEINPUT address_line1_as_entered BULKADDRESS1 address_line2_as_entered BULKADDRESS2 town_or_city_as_entered BULKTOWNCITY county_as_entered BULKCOUNTY postcode_full_as_entered BULKPOSTCODE la_as_entered BULKLA beds BEDS proptype PROPTYPE builtype BUILTYPE wchair WCHAIR age1 AGE1 sex1 SEX1 ethnic_group ETHNICGROUP1 ethnic ETHNIC nationality_all NATIONALITYALL1 ecstat1 ECSTAT1 buy1livein LIVEINBUYER1 relat2 RELAT2 age2 AGE2 sex2 SEX2 ethnic_group2 ETHNICGROUP2 ethnicbuy2 ETHNIC2 nationality_all_buyer2 NATIONALITYALL2 ecstat2 ECSTAT2 buy2livein LIVEINBUYER2 hholdcount HHTYPE relat3 RELAT3 age3 AGE3 sex3 SEX3 ecstat3 ECSTAT3 relat4 RELAT4 age4 AGE4 sex4 SEX4 ecstat4 ECSTAT4 relat5 RELAT5 age5 AGE5 sex5 SEX5 ecstat5 ECSTAT5 relat6 RELAT6 age6 AGE6 sex6 SEX6 ecstat6 ECSTAT6 prevten PREVTEN ppcodenk PPCODENK ppostc1 PPOSTC1 ppostc2 PPOSTC2 previous_la_known PREVIOUSLAKNOWN prevloc PREVLOC prevloc_label PREVLOCNAME pregyrha PREGYRHA pregother PREGOTHER pregla PREGLA pregghb PREGGHB pregblank PREGBLANK buy2living BUY2LIVING prevtenbuy2 PREVTEN2 hhregres HHREGRES hhregresstill HHREGRESSTILL armedforcesspouse ARMEDFORCESSPOUSE disabled DISABLED wheel WHEEL income1nk INC1NK income1 INCOME1 inc1mort INC1MORT income2nk INC2NK income2 INCOME2 inc2mort INC2MORT hb HB savingsnk SAVINGSNK savings SAVINGS prevown PREVOWN prevshared PREVSHARED proplen PROPLEN staircase STAIRCASE stairbought STAIRBOUGHT stairowned STAIROWNED staircasesale STAIRCASETOSALE resale RESALE exday EXDAY exmonth EXMONTH exyear EXYEAR hoday HODAY homonth HOMONTH hoyear HOYEAR lanomagr LANOMAGR soctenant SOCTEN frombeds FROMBEDS fromprop FROMPROP socprevten SOCPREVTEN value VALUE value_value_check VALUE_VALUE_CHECK equity EQUITY mortgageused MORTGAGEUSED mortgage MORTGAGE mortgagelender MORTGAGELENDER mortgagelenderother MORTGAGELENDEROTHER mortlen MORTLEN1 extrabor EXTRABOR deposit DEPOSIT cashdis CASHDIS mrent MRENT has_mscharge HASMSCHARGE mscharge MSCHARGE mscharge_value_check MSCHARGE_VALUE_CHECK discount DISCOUNT grant GRANT
2 in_progress in_progress 2024-05-01T00:00:00+01:00 2024-05-01T00:00:00+01:00 2024-05-01T00:00:00+01:00 2024-05-01T00:00:00+01:00 2024 2024 single log single log false false billyboy@eyeklaud.com DLUHC DLUHC DLUHC DLUHC billyboy@eyeklaud.com billyboy@eyeklaud.com billyboy@eyeklaud.com 1 1 5 5 2024 2024 Yes - a discounted ownership scheme Yes - a discounted ownership scheme Right to Acquire (RTA) Right to Acquire (RTA) Yes Yes Yes Yes Yes Yes 1 1 Address line 1 Address line 1 Town or city Town or city SW1A 1AA SW1A 1AA No No Barnet Barnet E09000003 E09000003 address line 1 as entered address line 1 as entered address line 2 as entered address line 2 as entered town or city as entered town or city as entered county as entered county as entered AB1 2CD AB1 2CD la as entered la as entered 2 2 Flat or maisonette Flat or maisonette Purpose built Purpose built Yes Yes 30 30 Non-binary Non-binary Buyer prefers not to say Buyer prefers not to say 17 17 Australia Australia Full-time - 30 hours or more Full-time - 30 hours or more Yes Yes Partner Partner 35 35 Non-binary Non-binary Buyer prefers not to say Buyer prefers not to say Full-time - 30 hours or more Full-time - 30 hours or more Yes Yes 3 3 Child Child 14 14 Non-binary Non-binary Child under 16 Child under 16 Other Other Not known Not known Non-binary Non-binary In government training into work In government training into work Prefers not to say Prefers not to say Not known Not known Prefers not to say Prefers not to say Prefers not to say Prefers not to say Local authority tenant Local authority tenant Yes Yes SW1A SW1A 1AA 1AA Yes Yes E09000003 E09000003 Barnet Barnet 1 1 1 1 1 1 1 1 Don't know Don't know Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes 10000 10000 Yes Yes Yes Yes 10000 10000 Yes Yes Don’t know Don’t know No No Yes Yes No No 10 10 110000.0 110000.0 Yes Yes 20000.0 20000.0 Cambridge Building Society Cambridge Building Society 10 10 Yes Yes 80000.0 80000.0 Yes Yes 100.0 100.0 10000.0 10000.0

52
spec/services/csv/sales_log_csv_service_spec.rb

@ -52,7 +52,7 @@ RSpec.describe Csv::SalesLogCsvService do
end
it "returns a csv with headers" do
expect(csv.first.first).to eq "id"
expect(csv.first.first).to eq "ID"
end
context "when stubbing :ordered_questions_for_year" do
@ -84,13 +84,13 @@ RSpec.describe Csv::SalesLogCsvService do
it "includes log attributes related to questions to the headers" do
headers = csv.first
expect(headers).to include(*question_ids.first(3))
expect(headers).to include(*%w[TYPE AGE1 LIVEINBUYER1])
end
it "removes some log attributes related to questions from the headers and replaces them with their derived values in the correct order" do
headers = csv.first
expect(headers).not_to include "exdate"
expect(headers.last(4)).to eq %w[buy1livein exday exmonth exyear]
expect(headers).not_to include "EXDATE"
expect(headers.last(4)).to eq %w[LIVEINBUYER1 EXDAY EXMONTH EXYEAR]
end
end
@ -115,14 +115,14 @@ RSpec.describe Csv::SalesLogCsvService do
it "does not add the id of checkbox questions, but adds the related attributes of the log in the correct order" do
headers = csv.first
expect(headers.last(4)).to eq %w[ownershipsch pregyrha pregother type]
expect(headers.last(4)).to eq %w[OWNERSHIP PREGYRHA PREGOTHER TYPE]
end
end
end
it "includes attributes not related to questions to the headers" do
headers = csv.first
expect(headers).to include(*%w[id status created_at updated_at])
expect(headers).to include(*%w[ID STATUS CREATEDDATE UPLOADDATE])
end
it "returns a csv with the correct number of logs" do
@ -136,35 +136,35 @@ RSpec.describe Csv::SalesLogCsvService do
let(:year) { 2023 }
it "gives answers to radio questions as their labels" do
national_column_index = csv.first.index("national")
national_column_index = csv.first.index("NATIONAL")
national_value = csv.second[national_column_index]
expect(national_value).to eq "United Kingdom"
relat2_column_index = csv.first.index("relat2")
relat2_column_index = csv.first.index("RELAT2")
relat2_value = csv.second[relat2_column_index]
expect(relat2_value).to eq "Partner"
end
it "gives answers to free input questions as the user input" do
age1_column_index = csv.first.index("age1")
age1_column_index = csv.first.index("AGE1")
age1_value = csv.second[age1_column_index]
expect(age1_value).to eq 30.to_s
postcode_part1, postcode_part2 = log.postcode_full.split
postcode_part1_column_index = csv.first.index("pcode1")
postcode_part1_column_index = csv.first.index("PCODE1")
postcode_part1_value = csv.second[postcode_part1_column_index]
expect(postcode_part1_value).to eq postcode_part1
postcode_part2_column_index = csv.first.index("pcode2")
postcode_part2_column_index = csv.first.index("PCODE2")
postcode_part2_value = csv.second[postcode_part2_column_index]
expect(postcode_part2_value).to eq postcode_part2
end
it "exports the code for the local authority under the heading 'la'" do
la_column_index = csv.first.index("la")
la_column_index = csv.first.index("LA")
la_value = csv.second[la_column_index]
expect(la_value).to eq "E09000003"
end
it "exports the label for the local authority under the heading 'la_label'" do
la_label_column_index = csv.first.index("la_label")
la_label_column_index = csv.first.index("LANAME")
la_label_value = csv.second[la_label_column_index]
expect(la_label_value).to eq "Barnet"
end
@ -180,7 +180,7 @@ RSpec.describe Csv::SalesLogCsvService do
it "exports the CSV with the 2024 ordering and all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_labels_24.csv")
values_to_delete = %w[id]
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
@ -195,7 +195,7 @@ RSpec.describe Csv::SalesLogCsvService do
it "exports the CSV with the 2023 ordering and all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_labels_23.csv")
values_to_delete = %w[id]
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
@ -210,7 +210,7 @@ RSpec.describe Csv::SalesLogCsvService do
end
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_column_index = csv.first.index("DUPLICATESET")
duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
expect(duplicate_set_id_value).to eq "12312"
end
@ -222,35 +222,35 @@ RSpec.describe Csv::SalesLogCsvService do
let(:year) { 2023 }
it "gives answers to radio questions as their codes" do
national_column_index = csv.first.index("national")
national_column_index = csv.first.index("NATIONAL")
national_value = csv.second[national_column_index]
expect(national_value).to eq 18.to_s
relat2_column_index = csv.first.index("relat2")
relat2_column_index = csv.first.index("RELAT2")
relat2_value = csv.second[relat2_column_index]
expect(relat2_value).to eq "P"
end
it "gives answers to free input questions as the user input" do
age1_column_index = csv.first.index("age1")
age1_column_index = csv.first.index("AGE1")
age1_value = csv.second[age1_column_index]
expect(age1_value).to eq 30.to_s
postcode_part1, postcode_part2 = log.postcode_full.split
postcode_part1_column_index = csv.first.index("pcode1")
postcode_part1_column_index = csv.first.index("PCODE1")
postcode_part1_value = csv.second[postcode_part1_column_index]
expect(postcode_part1_value).to eq postcode_part1
postcode_part2_column_index = csv.first.index("pcode2")
postcode_part2_column_index = csv.first.index("PCODE2")
postcode_part2_value = csv.second[postcode_part2_column_index]
expect(postcode_part2_value).to eq postcode_part2
end
it "exports the code for the local authority under the heading 'la'" do
la_column_index = csv.first.index("la")
la_column_index = csv.first.index("LA")
la_value = csv.second[la_column_index]
expect(la_value).to eq "E09000003"
end
it "exports the label for the local authority under the heading 'la_label'" do
la_label_column_index = csv.first.index("la_label")
la_label_column_index = csv.first.index("LANAME")
la_label_value = csv.second[la_label_column_index]
expect(la_label_value).to eq "Barnet"
end
@ -262,7 +262,7 @@ RSpec.describe Csv::SalesLogCsvService do
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_codes_24.csv")
values_to_delete = %w[id]
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
@ -277,7 +277,7 @@ RSpec.describe Csv::SalesLogCsvService do
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_codes_23.csv")
values_to_delete = %w[id]
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = csv.first.index(attribute)
csv.second[index] = nil
@ -292,7 +292,7 @@ RSpec.describe Csv::SalesLogCsvService do
end
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_column_index = csv.first.index("DUPLICATESET")
duplicate_set_id_value = csv.second[duplicate_set_id_column_index]
expect(duplicate_set_id_value).to eq "12312"
end

Loading…
Cancel
Save