From bda8381cdb3b42e18b934c4f92f7575eaa956464 Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 21 Feb 2023 10:30:18 +0000 Subject: [PATCH] Add totadult/totchild and outright sale examples --- .../imports/sales_logs_import_service.rb | 10 ++++----- .../00d2343e-d5fa-4c89-8400-ec3854b0f2b4.xml | 2 ++ .../0b4a68df-30cc-474a-93c0-a56ce8fdad3b.xml | 2 ++ .../0ead17cb-1668-442d-898c-0d52879ff592.xml | 2 ++ .../166fc004-392e-47a8-acb8-1c018734882b.xml | 22 +++++++++++-------- .../5ybz29dj-l33t-k1l0-hj86-n4k4ma77xkcd.xml | 21 ++++++++++-------- .../893ufj2s-lq77-42m4-rty6-ej09gh585uy1.xml | 2 ++ 7 files changed, 38 insertions(+), 23 deletions(-) diff --git a/app/services/imports/sales_logs_import_service.rb b/app/services/imports/sales_logs_import_service.rb index ddafc0ccf..d5e31fab9 100644 --- a/app/services/imports/sales_logs_import_service.rb +++ b/app/services/imports/sales_logs_import_service.rb @@ -93,7 +93,7 @@ module Imports attributes["grant"] = safe_string_as_decimal(xml_doc, "Q32REDUCTIONS") attributes["pregyrha"] = 1 if string_or_nil(xml_doc, "PREGYRHA") == "Yes" attributes["pregla"] = 1 if string_or_nil(xml_doc, "PREGLA") == "Yes" - attributes["pregghb"] = 1 if string_or_nil(xml_doc, "PREGHBA") == "Yes" # PREGHBA? + attributes["pregghb"] = 1 if string_or_nil(xml_doc, "PREGHBA") == "Yes" attributes["pregother"] = 1 if string_or_nil(xml_doc, "PREGOTHER") == "Yes" attributes["ppostcode_full"] = compose_postcode(xml_doc, "PPOSTC1", "PPOSTC2") attributes["prevloc"] = string_or_nil(xml_doc, "Q7ONSLACODE") @@ -117,12 +117,12 @@ module Imports attributes["hoyear"] = safe_string_as_integer(xml_doc, "HOYEAR") attributes["fromprop"] = unsafe_string_as_integer(xml_doc, "Q21PROPERTYTYPE") attributes["socprevten"] = nil # ? - attributes["mortgagelender"] = mortgage_lender(xml_doc, attributes) # there's mortgagelender 1/2/3? Q24AMORTGAGELENDER Q34AMORTGAGELENDER Q41AMORTGAGELENDER + attributes["mortgagelender"] = mortgage_lender(xml_doc, attributes) attributes["mortgagelenderother"] = nil # Q24AMORTGAGELENDEROTHER Q34AMORTGAGELENDEROTHER Q41AMORTGAGELENDEROTHER - attributes["mortlen"] = mortgage_length(xml_doc, attributes) # there's mortlen 1/2/3? Q24B Q34B Q41B + attributes["mortlen"] = mortgage_length(xml_doc, attributes) attributes["extrabor"] = unsafe_string_as_integer(xml_doc, "Q25BORROWING") - # attributes["totadult"] = safe_string_as_integer(xml_doc, "TOTADULT") # these would get overridden anyways - # attributes["totchild"] = safe_string_as_integer(xml_doc, "TOTCHILD") # these would get overridden anyways + attributes["totadult"] = safe_string_as_integer(xml_doc, "TOTADULT") # would get overridden + attributes["totchild"] = safe_string_as_integer(xml_doc, "TOTCHILD") # would get overridden attributes["hhtype"] = unsafe_string_as_integer(xml_doc, "HHTYPE") attributes["pcode1"] = string_or_nil(xml_doc, "PCODE1") attributes["pcode2"] = string_or_nil(xml_doc, "PCODE2") 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 e951eb244..24c8b7b01 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 @@ -83,6 +83,8 @@ Yes 1 Yes 6 + 5 + 1 4 diff --git a/spec/fixtures/imports/sales_logs/0b4a68df-30cc-474a-93c0-a56ce8fdad3b.xml b/spec/fixtures/imports/sales_logs/0b4a68df-30cc-474a-93c0-a56ce8fdad3b.xml index f84534931..e42a0f3b5 100644 --- a/spec/fixtures/imports/sales_logs/0b4a68df-30cc-474a-93c0-a56ce8fdad3b.xml +++ b/spec/fixtures/imports/sales_logs/0b4a68df-30cc-474a-93c0-a56ce8fdad3b.xml @@ -77,6 +77,8 @@ Yes 1 Yes 6 + 5 + 1 4 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 94297aee8..4612ae236 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 @@ -99,6 +99,8 @@ Yes 1 Yes 6 + 5 + 1 4 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 de45b2f98..42bfab90d 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 @@ -21,9 +21,10 @@ 5 11 2022 - 2 Yes - a discount ownership scheme - 8 Right to Acquire (RTA) - + 3 No - this is an outright or other sale + 12 Other + other + 2 No 1 Yes 2 1 Yes @@ -32,6 +33,7 @@ 30 Non-binary 17 Republic of Ireland + 1 Yes 1 Yes Partner 1 Flat or maisonette @@ -68,15 +70,17 @@ 90_000 250_000 - 10_000 + - 10 + Yes Yes Yes Yes 1 Yes 6 + 5 + 1 4 @@ -94,12 +98,12 @@ 6 No they left more than 2 years ago 100 - 10 - + + 10 If postcode not known tick - 5 - + + 5 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 216977671..57ade3297 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 @@ -21,9 +21,9 @@ 5 11 2022 - 2 Yes - a discount ownership scheme - 8 Right to Acquire (RTA) - + 3 No - this is an outright or other sale + 10 Outright + 2 No 1 Yes 2 1 Yes @@ -32,6 +32,7 @@ 30 Non-binary 17 Republic of Ireland + 1 Yes 1 Yes Partner 1 Flat or maisonette @@ -68,15 +69,17 @@ 90_000 250_000 - 10_000 + - 10 + Yes Yes Yes Yes 1 Yes 6 + 5 + 1 4 @@ -94,12 +97,12 @@ 5 No they left up to and including 2 years ago 100 - 10 - + + 10 If postcode not known tick - 5 - + + 5 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 f6bf24a01..4a2f9218d 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 @@ -77,6 +77,8 @@ Yes 1 Yes 6 + 5 + 1 4