Browse Source

CLDC-1938 Fix household members import (#1372)

* Fix household members

* Add test
pull/1343/head^2
kosiakkatrina 2 years ago committed by GitHub
parent
commit
246b34a727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/services/imports/sales_logs_import_service.rb
  2. 7
      spec/services/imports/sales_logs_import_service_spec.rb

8
app/services/imports/sales_logs_import_service.rb

@ -432,9 +432,11 @@ module Imports
end
def household_members(_xml_doc, attributes)
return attributes["hholdcount"] + 2 if attributes["jointpur"] == 1
attributes["hholdcount"] + 1 if attributes["jointpur"] == 2
if attributes["jointpur"] == 2
attributes["hholdcount"] + 1
else
attributes["hholdcount"] + 2
end
end
def set_default_values(attributes)

7
spec/services/imports/sales_logs_import_service_spec.rb

@ -604,6 +604,13 @@ RSpec.describe Imports::SalesLogsImportService do
sales_log = SalesLog.find_by(old_id: sales_log_id)
expect(sales_log&.hholdcount).to eq(0)
end
it "doesn't hang if jointpur is not given" do
sales_log_xml.at_xpath("//xmlns:joint").content = ""
sales_log_xml.at_xpath("//xmlns:HHMEMB").content = "0"
sales_log_service.send(:create_log, sales_log_xml)
end
end
context "when inferring income used" do

Loading…
Cancel
Save