diff --git a/app/services/imports/sales_logs_import_service.rb b/app/services/imports/sales_logs_import_service.rb
index 4bb44c2b5..f0d2e7b53 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"] = nil # ?
- attributes["stairowned"] = nil # ?
+ 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")
@@ -87,7 +87,6 @@ module Imports
attributes["cashdis"] = safe_string_as_decimal(xml_doc, "Q27SOCIALHOMEBUY")
attributes["disabled"] = unsafe_string_as_integer(xml_doc, "DISABILITY")
attributes["lanomagr"] = unsafe_string_as_integer(xml_doc, "Q19REHOUSED")
- attributes["soctenant"] = nil # ?
attributes["value"] = safe_string_as_decimal(xml_doc, "Q22PURCHASEPRICE")
attributes["equity"] = safe_string_as_decimal(xml_doc, "Q23EQUITY")
attributes["discount"] = safe_string_as_decimal(xml_doc, "Q33DISCOUNT")
@@ -136,7 +135,8 @@ module Imports
attributes["ethnicbuy2"] = nil
attributes["prevshared"] = nil
attributes["staircasesale"] = nil
-
+ attributes["soctenant"] = soctenant(attributes)
+
# Required for our form invalidated questions (not present in import)
attributes["previous_la_known"] = attributes["prevloc"].nil? ? 0 : 1
attributes["is_la_inferred"] = attributes["postcode_full"].present?
@@ -393,5 +393,16 @@ module Imports
1
end
end
+
+ def soctenant(attributes)
+ return nil unless attributes["ownershipsch"] == 1
+
+ if attributes["frombeds"].blank? && attributes["fromprop"].blank? && attributes["socprevten"].blank?
+ 2
+ else
+ 1
+ end
+ # NO (2) if FROMBEDS, FROMPROP and socprevten are blank, and YES(1) if they are completed
+ 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 6876927a0..9afe9ad0a 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
@@ -22,10 +22,8 @@
11
2022
-
- 2 Yes - a discount ownership scheme
- 8 Right to Acquire (RTA)
+ 1 Yes - a shared ownership scheme
+ 18 Social Homebuy (shared ownership purchase)
1 Yes
2
@@ -68,16 +66,17 @@
5 Retired
1 Full Time - 30 hours or more a week
1 Yes
- 90_000
-
- 250_000
- 10_000
-
-
-
-
-
- 10
+ 300
+ 70_000
+ 230_000
+ 0
+ 1 Yes
+ 10
+ 10
+ 1 Yes
+
+ 10_000
+ 100
Yes
Yes
Yes
@@ -98,12 +97,12 @@
1 Yes
5 No
100
-
- 10
+ 10
+
If postcode not known tick
-
- 5
+ 5
+