From 7bff1d100b6925027bf3e96cfbd9be4c5e21c1a3 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Thu, 5 May 2022 12:44:25 +0100 Subject: [PATCH] Set major repair date --- app/services/imports/case_logs_import_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/imports/case_logs_import_service.rb b/app/services/imports/case_logs_import_service.rb index d1814767a..8d3db10c8 100644 --- a/app/services/imports/case_logs_import_service.rb +++ b/app/services/imports/case_logs_import_service.rb @@ -129,7 +129,11 @@ module Imports attributes["voiddate"] = compose_date(xml_doc, "VDAY", "VMONTH", "VYEAR") attributes["mrcdate"] = compose_date(xml_doc, "MRCDAY", "MRCMONTH", "MRCYEAR") - attributes["majorrepairs"] = attributes["mrcdate"].present? ? 1 : nil + attributes["majorrepairs"] = if attributes["mrcdate"].present? && previous_status.include?("submitted") + 1 + elsif previous_status.include?("submitted") + 0 + end attributes["offered"] = safe_string_as_integer(xml_doc, "Q20") attributes["propcode"] = string_or_nil(xml_doc, "Q21a")