From e5fdd45a5ef39bff44d87cb7d2662acc15983303 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Thu, 29 Jun 2023 16:22:39 +0100 Subject: [PATCH] Reimport offered (#1737) * Add method for importing the 'offered' field into already imported lettings logs * Add minimal tests * feat: update tests * feat: update take task * feat: update rake task * feat: update rake task * feat: update rake task spec * feat: update rake task and tests * feat: typo fix and return for sales logs * feat: update rake task * feat: update rake task * feat: typo fix and return for sales logs --------- Co-authored-by: Rachael Booth --- .../imports/lettings_logs_field_import_service.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/services/imports/lettings_logs_field_import_service.rb b/app/services/imports/lettings_logs_field_import_service.rb index 8e33da0c2..a976e15b2 100644 --- a/app/services/imports/lettings_logs_field_import_service.rb +++ b/app/services/imports/lettings_logs_field_import_service.rb @@ -18,6 +18,8 @@ module Imports private def update_offered(xml_doc) + return if meta_field_value(xml_doc, "form-name").include?("Sales") + old_id = meta_field_value(xml_doc, "document-id") record = LettingsLog.find_by(old_id:) @@ -27,7 +29,7 @@ module Imports else offered = safe_string_as_integer(xml_doc, "Q20") record.update!(offered:) - @logger.info("lettings log #{record.id}'s offered value has been set to #{offered}'") + @logger.info("lettings log #{record.id}'s offered value has been set to #{offered}") end else @logger.warn("lettings log with old id #{old_id} not found") @@ -35,6 +37,8 @@ module Imports end def update_lettings_allocation(xml_doc) + return if meta_field_value(xml_doc, "form-name").include?("Sales") + old_id = meta_field_value(xml_doc, "document-id") previous_status = meta_field_value(xml_doc, "status") record = LettingsLog.find_by(old_id:) @@ -65,6 +69,8 @@ module Imports end def update_major_repairs(xml_doc) + return if meta_field_value(xml_doc, "form-name").include?("Sales") + old_id = meta_field_value(xml_doc, "document-id") record = LettingsLog.find_by(old_id:) @@ -88,6 +94,8 @@ module Imports end def update_tenant_code(xml_doc) + return if meta_field_value(xml_doc, "form-name").include?("Sales") + old_id = meta_field_value(xml_doc, "document-id") record = LettingsLog.find_by(old_id:)