Browse Source

Age known believe import fixes (#545)

* amend fixture to make test fail

* fix failing test

* lint fixes
pull/619/head
Dushan 3 years ago committed by baarkerlounger
parent
commit
f4401869de
  1. 13
      app/services/imports/case_logs_import_service.rb
  2. 4
      spec/fixtures/softwire_imports/case_logs/0ead17cb-1668-442d-898c-0d52879ff592.xml

13
app/services/imports/case_logs_import_service.rb

@ -345,11 +345,14 @@ module Imports
return nil if hhmemb.present? && index > hhmemb return nil if hhmemb.present? && index > hhmemb
age_refused = string_or_nil(xml_doc, "P#{index}AR") age_refused = string_or_nil(xml_doc, "P#{index}AR")
if age_refused == "AGE_REFUSED" if age_refused.present?
1 # No if age_refused.casecmp("AGE_REFUSED").zero?
else return 1 # No
0 # Yes else
return 0 # Yes
end
end end
0
end end
def details_known(index, attributes) def details_known(index, attributes)
@ -501,7 +504,7 @@ module Imports
end end
def people_with_details(xml_doc) def people_with_details(xml_doc)
((2..8).map { |x| string_or_nil(xml_doc, "P#{x}Rel") } + [string_or_nil(xml_doc, "P1Age")]).compact ((2..8).map { |x| string_or_nil(xml_doc, "P#{x}Rel") } + [string_or_nil(xml_doc, "P1Sex")]).compact
end end
end end
end end

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

@ -48,8 +48,8 @@
<_2cYears/> <_2cYears/>
</Group> </Group>
<Group> <Group>
<P1Age override-field="">23</P1Age> <P1Age override-field=""/>
<P1AR/> <P1AR>Age_Refused</P1AR>
<P1Sex override-field="">Female</P1Sex> <P1Sex override-field="">Female</P1Sex>
<P1Eco>6) Not Seeking Work</P1Eco> <P1Eco>6) Not Seeking Work</P1Eco>
<P1Eth>17 Refused</P1Eth> <P1Eth>17 Refused</P1Eth>

Loading…
Cancel
Save