From 891fcba9fe9adda668b4ec669c9a775649261197 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 4 May 2022 11:12:02 +0100 Subject: [PATCH 1/4] Fix condition affects question (illness type) --- app/services/imports/case_logs_import_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/imports/case_logs_import_service.rb b/app/services/imports/case_logs_import_service.rb index 3bf1bc0dc..ff347f421 100644 --- a/app/services/imports/case_logs_import_service.rb +++ b/app/services/imports/case_logs_import_service.rb @@ -458,9 +458,9 @@ module Imports def illness_type(xml_doc, index, illness) illness_type = string_or_nil(xml_doc, "Q10ib-#{index}") - if illness_type == "Yes" && illness == "Yes" + if illness_type == "Yes" && illness == 1 1 - elsif illness == "Yes" + elsif illness == 1 0 end end From 6d9f0311c4aa9dc55d80059ceef1d61ddaaaae2d Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 4 May 2022 11:41:26 +0100 Subject: [PATCH 2/4] Make case log status rely on subsection status so they can't get out of sync --- app/models/case_log.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 252b6e360..fd977e11e 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -609,7 +609,8 @@ private end def all_fields_completed? - mandatory_fields.none? { |field| public_send(field).nil? if respond_to?(field) } + subsection_statuses = form.subsections.map { |subsection| subsection.status(self) }.uniq + subsection_statuses == [:completed] end def all_fields_nil? From d9e0526a5991d5f89454908b20e3961c89a51912 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 4 May 2022 12:13:09 +0100 Subject: [PATCH 3/4] Fix complete case log fixture --- spec/fixtures/complete_case_log.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 62d593be7..8acc0814c 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -50,6 +50,7 @@ "tenancylength": 5, "tenancy": 1, "landlord": 1, + "previous_la_known": 1, "la": "Barnet", "postcode_full": "NW1 5TY", "property_relet": 0, @@ -80,7 +81,7 @@ "prevloc": "E07000105", "ppostcode_full": "SE2 6RT", "reasonpref": 1, - "cbl": 1, + "cbl": 0, "chr": 1, "cap": 0, "hbrentshortfall": 1, From 03d9560c0e4ee68f8e224d89497925e363f3c351 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 4 May 2022 13:09:59 +0100 Subject: [PATCH 4/4] Fix Reason preference reason and lettings allocation answer option import --- .../imports/case_logs_import_service.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/services/imports/case_logs_import_service.rb b/app/services/imports/case_logs_import_service.rb index ff347f421..659168631 100644 --- a/app/services/imports/case_logs_import_service.rb +++ b/app/services/imports/case_logs_import_service.rb @@ -105,15 +105,15 @@ module Imports attributes["homeless"] = unsafe_string_as_integer(xml_doc, "Q13") attributes["reasonpref"] = unsafe_string_as_integer(xml_doc, "Q14a") - attributes["rp_homeless"] = unsafe_string_as_integer(xml_doc, "Q14b1") - attributes["rp_insan_unsat"] = unsafe_string_as_integer(xml_doc, "Q14b2") - attributes["rp_medwel"] = unsafe_string_as_integer(xml_doc, "Q14b3") - attributes["rp_hardship"] = unsafe_string_as_integer(xml_doc, "Q14b4") - attributes["rp_dontknow"] = unsafe_string_as_integer(xml_doc, "Q14b5") - - attributes["cbl"] = unsafe_string_as_integer(xml_doc, "Q15CBL") - attributes["chr"] = unsafe_string_as_integer(xml_doc, "Q15CHR") - attributes["cap"] = unsafe_string_as_integer(xml_doc, "Q15CAP") + attributes["rp_homeless"] = unsafe_string_as_integer(xml_doc, "Q14b1").present? ? 1 : nil + attributes["rp_insan_unsat"] = unsafe_string_as_integer(xml_doc, "Q14b2").present? ? 1 : nil + attributes["rp_medwel"] = unsafe_string_as_integer(xml_doc, "Q14b3").present? ? 1 : nil + attributes["rp_hardship"] = unsafe_string_as_integer(xml_doc, "Q14b4").present? ? 1 : nil + attributes["rp_dontknow"] = unsafe_string_as_integer(xml_doc, "Q14b5").present? ? 1 : nil + + attributes["cbl"] = unsafe_string_as_integer(xml_doc, "Q15CBL").present? ? 1 : nil + attributes["chr"] = unsafe_string_as_integer(xml_doc, "Q15CHR").present? ? 1 : nil + attributes["cap"] = unsafe_string_as_integer(xml_doc, "Q15CAP").present? ? 1 : nil attributes["referral"] = unsafe_string_as_integer(xml_doc, "Q16") attributes["period"] = unsafe_string_as_integer(xml_doc, "Q17")