@ -57,7 +57,7 @@ module Imports
def create_log ( xml_doc )
def create_log ( xml_doc )
attributes = { }
attributes = { }
previous_status = field_value ( xml_doc , " meta " , " status " )
previous_status = meta_ field_value( xml_doc , " status " )
# Required fields for status complete or logic to work
# Required fields for status complete or logic to work
# Note: order matters when we derive from previous values (attributes parameter)
# Note: order matters when we derive from previous values (attributes parameter)
@ -191,9 +191,9 @@ module Imports
# Not specific to our form but required for consistency (present in import)
# Not specific to our form but required for consistency (present in import)
attributes [ " old_form_id " ] = safe_string_as_integer ( xml_doc , " FORM " )
attributes [ " old_form_id " ] = safe_string_as_integer ( xml_doc , " FORM " )
attributes [ " created_at " ] = Time . zone . parse ( field_value ( xml_doc , " meta " , " created-date " ) )
attributes [ " created_at " ] = Time . zone . parse ( meta_ field_value( xml_doc , " created-date " ) )
attributes [ " updated_at " ] = Time . zone . parse ( field_value ( xml_doc , " meta " , " modified-date " ) )
attributes [ " updated_at " ] = Time . zone . parse ( meta_ field_value( xml_doc , " modified-date " ) )
attributes [ " old_id " ] = field_value ( xml_doc , " meta " , " document-id " )
attributes [ " old_id " ] = meta_ field_value( xml_doc , " document-id " )
# Required for our form invalidated questions (not present in import)
# Required for our form invalidated questions (not present in import)
attributes [ " previous_la_known " ] = attributes [ " prevloc " ] . nil? ? 0 : 1
attributes [ " previous_la_known " ] = attributes [ " prevloc " ] . nil? ? 0 : 1
@ -236,7 +236,7 @@ module Imports
attributes [ " net_income_value_check " ] = 0
attributes [ " net_income_value_check " ] = 0
# Sets the log creator
# Sets the log creator
owner_id = field_value ( xml_doc , " meta " , " owner-user-id " ) . strip
owner_id = meta_ field_value( xml_doc , " owner-user-id " ) . strip
if owner_id . present?
if owner_id . present?
user = LegacyUser . find_by ( old_user_id : owner_id ) & . user
user = LegacyUser . find_by ( old_user_id : owner_id ) & . user
@logger . warn " Missing user! We expected to find a legacy user with old_user_id #{ owner_id } " unless user
@logger . warn " Missing user! We expected to find a legacy user with old_user_id #{ owner_id } " unless user
@ -355,7 +355,7 @@ module Imports
end
end
def get_form_name_component ( xml_doc , index )
def get_form_name_component ( xml_doc , index )
form_name = field_value ( xml_doc , " meta " , " form-name " )
form_name = meta_ field_value( xml_doc , " form-name " )
form_type_components = form_name . split ( " - " )
form_type_components = form_name . split ( " - " )
form_type_components [ index ]
form_type_components [ index ]
end
end