Browse Source

Import old for id

pull/1851/head
Kat 3 years ago
parent
commit
237355f798
  1. 1
      app/services/imports/sales_logs_import_service.rb
  2. 11
      spec/services/imports/sales_logs_import_service_spec.rb

1
app/services/imports/sales_logs_import_service.rb

@ -28,6 +28,7 @@ module Imports
attributes["owning_organisation_id"] = find_organisation_id(xml_doc, "OWNINGORGID") attributes["owning_organisation_id"] = find_organisation_id(xml_doc, "OWNINGORGID")
attributes["type"] = unsafe_string_as_integer(xml_doc, "DerSaleType") attributes["type"] = unsafe_string_as_integer(xml_doc, "DerSaleType")
attributes["old_id"] = meta_field_value(xml_doc, "document-id") attributes["old_id"] = meta_field_value(xml_doc, "document-id")
attributes["old_form_id"] = safe_string_as_integer(xml_doc, "Form")
attributes["creation_method"] = creation_method(xml_doc) attributes["creation_method"] = creation_method(xml_doc)
attributes["created_at"] = Time.zone.parse(meta_field_value(xml_doc, "created-date")) attributes["created_at"] = Time.zone.parse(meta_field_value(xml_doc, "created-date"))
attributes["updated_at"] = Time.zone.parse(meta_field_value(xml_doc, "modified-date")) attributes["updated_at"] = Time.zone.parse(meta_field_value(xml_doc, "modified-date"))

11
spec/services/imports/sales_logs_import_service_spec.rb

@ -139,6 +139,17 @@ RSpec.describe Imports::SalesLogsImportService do
end end
end end
context "when the log is valid" do
let(:sales_log_id) { "shared_ownership_sales_log" }
it "correctly sets old form id" do
sales_log_service.send(:create_log, sales_log_xml)
sales_log = SalesLog.find_by(old_id: sales_log_id)
expect(sales_log&.old_form_id).to eq(300_204)
end
end
context "when the mortgage lender is set to an existing option" do context "when the mortgage lender is set to an existing option" do
let(:sales_log_id) { "discounted_ownership_sales_log" } let(:sales_log_id) { "discounted_ownership_sales_log" }

Loading…
Cancel
Save