diff --git a/app/services/imports/sales_logs_import_service.rb b/app/services/imports/sales_logs_import_service.rb index 21df82297..ddafc0ccf 100644 --- a/app/services/imports/sales_logs_import_service.rb +++ b/app/services/imports/sales_logs_import_service.rb @@ -75,8 +75,8 @@ module Imports attributes["hb"] = unsafe_string_as_integer(xml_doc, "Q2A") attributes["frombeds"] = safe_string_as_integer(xml_doc, "Q20BEDROOMS") attributes["staircase"] = unsafe_string_as_integer(xml_doc, "Q17ASTAIRCASE") - attributes["stairbought"] = safe_string_as_integer(xml_doc, "PERCENTBOUGHT") # ? - attributes["stairowned"] = safe_string_as_integer(xml_doc, "PERCENTOWNS") # ? + attributes["stairbought"] = safe_string_as_integer(xml_doc, "PERCENTBOUGHT") + attributes["stairowned"] = safe_string_as_integer(xml_doc, "PERCENTOWNS") attributes["mrent"] = safe_string_as_decimal(xml_doc, "Q28MONTHLYRENT") attributes["exdate"] = compose_date(xml_doc, "EXDAY", "EXMONTH", "EXYEAR") attributes["exday"] = safe_string_as_integer(xml_doc, "EXDAY") @@ -103,7 +103,7 @@ module Imports attributes["ppostc2"] = string_or_nil(xml_doc, "PPOSTC2") attributes["previous_la_known"] = nil attributes["hhregres"] = unsafe_string_as_integer(xml_doc, "ARMEDF") - attributes["hhregresstill"] = 7 # are we not collecting this? 7 == don't know + attributes["hhregresstill"] = still_serving(xml_doc) attributes["proplen"] = safe_string_as_integer(xml_doc, "Q30A") attributes["mscharge"] = safe_string_as_decimal(xml_doc, "Q29MONTHLYCHARGES") attributes["mscharge_known"] = 1 if attributes["mscharge"].present? @@ -404,5 +404,14 @@ module Imports end # NO (2) if FROMBEDS, FROMPROP and socprevten are blank, and YES(1) if they are completed end + + def still_serving(xml_doc) + case unsafe_string_as_integer(xml_doc, "LEFTARMEDF") + when 4 + 4 + when 5, 6 + 5 + end + end end 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 c609271df..e951eb244 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 @@ -97,6 +97,7 @@ 1 Yes 1 Yes 5 No + 6 No they left more than 2 years ago 100 10 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 491b102eb..f84534931 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 @@ -91,6 +91,7 @@ 1 Yes 1 Yes 5 No + 6 No they left more than 2 years ago 100 10 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 df187d967..94297aee8 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 @@ -113,6 +113,7 @@ 1 Yes 1 Yes 5 No + 4 Yes 100 10 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 3ac30a749..de45b2f98 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 @@ -91,6 +91,7 @@ 1 Yes 1 Yes 5 No + 6 No they left more than 2 years ago 100 10 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 748367a77..216977671 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 @@ -91,6 +91,7 @@ 1 Yes 1 Yes 5 No + 5 No they left up to and including 2 years ago 100 10 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 1cfb14b76..f6bf24a01 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 @@ -91,6 +91,7 @@ 1 Yes 1 Yes 5 No + 6 No they left more than 2 years ago 100 10