Browse Source

Set hhmemb to totadult and tchild sum if hhmemb is not given

Co-authored-by: Ted <tedbooton@gmail.com>
Co-authored-by: Dushan <dushan@madetech.com>
pull/540/head
Kat 4 years ago
parent
commit
6ff617c572
  1. 8
      app/services/imports/case_logs_import_service.rb
  2. 2
      spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml

8
app/services/imports/case_logs_import_service.rb

@ -56,7 +56,7 @@ module Imports
attributes["irproduct"] = unsafe_string_as_integer(xml_doc, "IRProduct")
attributes["irproduct_other"] = string_or_nil(xml_doc, "IRProductOther")
attributes["rent_type"] = rent_type(xml_doc, attributes["lar"], attributes["irproduct"])
attributes["hhmemb"] = safe_string_as_integer(xml_doc, "HHMEMB")
attributes["hhmemb"] = household_members(xml_doc, attributes)
(1..8).each do |index|
attributes["age#{index}"] = safe_string_as_integer(xml_doc, "P#{index}Age")
attributes["age#{index}_known"] = age_known(xml_doc, index, attributes["hhmemb"])
@ -489,5 +489,11 @@ module Imports
1
end
end
def household_members(xml_doc, attributes)
hhmemb = safe_string_as_integer(xml_doc, "HHMEMB")
return safe_string_as_integer(xml_doc, "TOTADULT") + safe_string_as_integer(xml_doc, "TCHILD") if hhmemb.nil?
hhmemb
end
end
end

2
spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml vendored

@ -393,7 +393,7 @@
<Q18aValid>1</Q18aValid>
<Q18Valid>1</Q18Valid>
<VACDAYS>0</VACDAYS>
<HHMEMB>2</HHMEMB>
<HHMEMB/>
<HHTYPEP1A>1</HHTYPEP1A>
<HHTYPEP2A>0</HHTYPEP2A>
<HHTYPEP3A>0</HHTYPEP3A>

Loading…
Cancel
Save