Browse Source

feat: update mapping to indicate privacy notice can be null in template if buyer not interviewed

CLDC-2412-data-privacy-bu
natdeanlewissoftwire 2 years ago
parent
commit
554201d0bf
  1. 2
      app/services/bulk_upload/sales/year2022/row_parser.rb
  2. 8
      app/services/bulk_upload/sales/year2023/row_parser.rb

2
app/services/bulk_upload/sales/year2022/row_parser.rb

@ -414,7 +414,7 @@ class BulkUpload::Sales::Year2022::RowParser
private
def validate_data_protection_answered
unless field_112 == 1
unless field_112 == 1 || buyer_not_interviewed?
errors.add(:field_112, I18n.t("validations.not_answered", question: QUESTIONS[:field_112].downcase), category: :setup)
end
end

8
app/services/bulk_upload/sales/year2023/row_parser.rb

@ -536,11 +536,15 @@ class BulkUpload::Sales::Year2023::RowParser
private
def validate_data_protection_answered
unless field_29 == 1
unless field_29 == 1 || buyer_not_interviewed?
errors.add(:field_29, I18n.t("validations.not_answered", question: QUESTIONS[:field_29].downcase), category: :setup)
end
end
def buyer_not_interviewed?
field_28 == 1
end
def prevtenbuy2
case field_72
when "R"
@ -753,7 +757,7 @@ private
attributes["purchid"] = purchaser_code
attributes["saledate"] = saledate
attributes["noint"] = 2 if field_28 == 1
attributes["noint"] = 2 if buyer_not_interviewed?
attributes["age1_known"] = age1_known?
attributes["age1"] = field_30 if attributes["age1_known"].zero? && field_30&.match(/\A\d{1,3}\z|\AR\z/)

Loading…
Cancel
Save