|
|
|
@ -329,14 +329,6 @@ class BulkUpload::Lettings::Year2023::RowParser
|
|
|
|
|
}, |
|
|
|
|
on: :after_log |
|
|
|
|
|
|
|
|
|
validates :field_11, |
|
|
|
|
presence: { |
|
|
|
|
if: proc { renttype == :intermediate }, |
|
|
|
|
message: I18n.t("validations.not_answered", question: "intermediate rent type"), |
|
|
|
|
category: :setup, |
|
|
|
|
}, |
|
|
|
|
on: :after_log |
|
|
|
|
|
|
|
|
|
validates :field_16, |
|
|
|
|
presence: { |
|
|
|
|
if: proc { supported_housing? }, |
|
|
|
@ -397,6 +389,9 @@ class BulkUpload::Lettings::Year2023::RowParser
|
|
|
|
|
|
|
|
|
|
validate :validate_incomplete_soft_validations, on: :after_log |
|
|
|
|
|
|
|
|
|
validate :validate_correct_intermediate_rent_type, on: :after_log, if: proc { renttype == :intermediate } |
|
|
|
|
validate :validate_correct_affordable_rent_type, on: :after_log, if: proc { renttype == :affordable } |
|
|
|
|
|
|
|
|
|
def self.question_for_field(field) |
|
|
|
|
QUESTIONS[field] |
|
|
|
|
end |
|
|
|
@ -841,6 +836,18 @@ private
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def validate_correct_intermediate_rent_type |
|
|
|
|
if field_11.blank? || ![1, 2, 3].include?(field_11.to_i) |
|
|
|
|
errors.add(:field_11, I18n.t("validations.not_answered", question: "intermediate rent type"), category: :setup) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def validate_correct_affordable_rent_type |
|
|
|
|
if field_10.blank? || ![1, 2, 3].include?(field_10.to_i) |
|
|
|
|
errors.add(:field_10, I18n.t("validations.not_answered", question: "is this a London Affordable Rent letting"), category: :setup) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def setup_question?(question) |
|
|
|
|
log.form.setup_sections[0].subsections[0].questions.include?(question) |
|
|
|
|
end |
|
|
|
@ -1327,9 +1334,10 @@ private
|
|
|
|
|
when :social |
|
|
|
|
LettingsLog::RENT_TYPE[:social_rent] |
|
|
|
|
when :affordable |
|
|
|
|
if field_10 == 1 |
|
|
|
|
case field_10 |
|
|
|
|
when 1 |
|
|
|
|
LettingsLog::RENT_TYPE[:london_affordable_rent] |
|
|
|
|
else |
|
|
|
|
when 2, 3 |
|
|
|
|
LettingsLog::RENT_TYPE[:affordable_rent] |
|
|
|
|
end |
|
|
|
|
when :intermediate |
|
|
|
|