diff --git a/app/services/imports/sales_logs_import_service.rb b/app/services/imports/sales_logs_import_service.rb index f0d2e7b53..2c8dc2817 100644 --- a/app/services/imports/sales_logs_import_service.rb +++ b/app/services/imports/sales_logs_import_service.rb @@ -57,8 +57,8 @@ module Imports attributes["builtype"] = unsafe_string_as_integer(xml_doc, "Q13BUILDINGTYPE") attributes["proptype"] = unsafe_string_as_integer(xml_doc, "Q12PROPERTYTYPE") attributes["noint"] = safe_string_as_integer(xml_doc, "NOINT") - attributes["buy2livein"] = unsafe_string_as_integer(xml_doc, "LIVEINBUYER2")# liveinbuyer2? - attributes["privacynotice"] = nil # always yes? + attributes["buy2livein"] = unsafe_string_as_integer(xml_doc, "LIVEINBUYER2") # liveinbuyer2? + attributes["privacynotice"] = 1 if string_or_nil(xml_doc, "QDP") == "Yes" # always yes? attributes["wheel"] = unsafe_string_as_integer(xml_doc, "Q10WHEELCHAIR") attributes["hholdcount"] = attributes["hhmemb"] - (attributes["jointpur"] == 1 ? 2 : 1) attributes["la"] = string_or_nil(xml_doc, "Q14ONSLACODE") @@ -68,7 +68,7 @@ module Imports attributes["income2"] = safe_string_as_integer(xml_doc, "Q2PERSON2INCOME") # should this be decimal? attributes["income2nk"] = 0 if attributes["income2"].present? # known if given? attributes["savings"] = safe_string_as_integer(xml_doc, "Q3SAVINGS") - attributes["savingsnk"] = savings_known(xml_doc)# 0 -> known, 1 - not known from the sales xml form, does this actually exist? + attributes["savingsnk"] = savings_known(xml_doc) # 0 -> known, 1 - not known from the sales xml form, does this actually exist? attributes["prevown"] = unsafe_string_as_integer(xml_doc, "Q4PREVOWNEDPROPERTY") attributes["mortgage"] = safe_string_as_decimal(xml_doc, "CALCMORT") attributes["inc2mort"] = unsafe_string_as_integer(xml_doc, "Q2PERSON2MORTAPPLICATION") @@ -363,7 +363,7 @@ module Imports end end - def mortgage_lender(xml_doc, attributes) + def mortgage_lender(xml_doc, attributes) case attributes["ownershipsch"] when 1 unsafe_string_as_integer(xml_doc, "Q24AMORTGAGELENDER") @@ -386,9 +386,9 @@ module Imports end def savings_known(xml_doc) - case unsafe_string_as_integer(xml_doc, "savingsKnown") + case unsafe_string_as_integer(xml_doc, "savingsKnown") when 1 # known - 0 + 0 when 2 # unknown 1 end diff --git a/spec/fixtures/imports/sales_logs/00d2343e-d5fa-4c89-8400-ec3854b0f2b4.xml b/spec/fixtures/imports/sales_logs/00d2343e-d5fa-4c89-8400-ec3854b0f2b4.xml index 9afe9ad0a..4f9d709d2 100644 --- a/spec/fixtures/imports/sales_logs/00d2343e-d5fa-4c89-8400-ec3854b0f2b4.xml +++ b/spec/fixtures/imports/sales_logs/00d2343e-d5fa-4c89-8400-ec3854b0f2b4.xml @@ -28,8 +28,8 @@ 1 Yes 2 1 Yes - 1 - + 2 + Yes 30 Non-binary 17 Republic of Ireland diff --git a/spec/fixtures/imports/sales_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml b/spec/fixtures/imports/sales_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml index cd8df639d..3682d3569 100644 --- a/spec/fixtures/imports/sales_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml +++ b/spec/fixtures/imports/sales_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml @@ -44,8 +44,8 @@ 1 Yes 2 1 Yes - 1 - + 2 + Yes 30 Non-binary 17 Republic of Ireland diff --git a/spec/fixtures/imports/sales_logs/166fc004-392e-47a8-acb8-1c018734882b.xml b/spec/fixtures/imports/sales_logs/166fc004-392e-47a8-acb8-1c018734882b.xml index 90ef21af1..a4e2280db 100644 --- a/spec/fixtures/imports/sales_logs/166fc004-392e-47a8-acb8-1c018734882b.xml +++ b/spec/fixtures/imports/sales_logs/166fc004-392e-47a8-acb8-1c018734882b.xml @@ -27,8 +27,8 @@ 1 Yes 2 1 Yes - 1 - + 2 + Yes 30 Non-binary 17 Republic of Ireland diff --git a/spec/fixtures/imports/sales_logs/5ybz29dj-l33t-k1l0-hj86-n4k4ma77xkcd.xml b/spec/fixtures/imports/sales_logs/5ybz29dj-l33t-k1l0-hj86-n4k4ma77xkcd.xml index 15b656265..1ece8859a 100644 --- a/spec/fixtures/imports/sales_logs/5ybz29dj-l33t-k1l0-hj86-n4k4ma77xkcd.xml +++ b/spec/fixtures/imports/sales_logs/5ybz29dj-l33t-k1l0-hj86-n4k4ma77xkcd.xml @@ -27,8 +27,8 @@ 1 Yes 2 1 Yes - 1 - + 2 + Yes 30 Non-binary 17 Republic of Ireland diff --git a/spec/fixtures/imports/sales_logs/893ufj2s-lq77-42m4-rty6-ej09gh585uy1.xml b/spec/fixtures/imports/sales_logs/893ufj2s-lq77-42m4-rty6-ej09gh585uy1.xml index 38caa92b1..a3f00d470 100644 --- a/spec/fixtures/imports/sales_logs/893ufj2s-lq77-42m4-rty6-ej09gh585uy1.xml +++ b/spec/fixtures/imports/sales_logs/893ufj2s-lq77-42m4-rty6-ej09gh585uy1.xml @@ -27,8 +27,8 @@ 1 Yes 2 1 Yes - 1 - + 2 + Yes 30 Non-binary 17 Republic of Ireland