Browse Source

refactor invert logic statement

pull/1288/head
Phil Lee 3 years ago
parent
commit
3133696e36
  1. 4
      app/services/bulk_upload/lettings/row_parser.rb

4
app/services/bulk_upload/lettings/row_parser.rb

@ -173,11 +173,11 @@ class BulkUpload::Lettings::RowParser
private
def validate_lettings_type_matches_bulk_upload
if [1, 3, 5, 7, 9, 11].include?(field_1) && bulk_upload.supported_housing?
if [1, 3, 5, 7, 9, 11].include?(field_1) && !bulk_upload.general_needs?
errors.add(:field_1, I18n.t("validations.setup.lettype.supported_housing_mismatch"))
end
if [2, 4, 6, 8, 10, 12].include?(field_1) && bulk_upload.general_needs?
if [2, 4, 6, 8, 10, 12].include?(field_1) && !bulk_upload.supported_housing?
errors.add(:field_1, I18n.t("validations.setup.lettype.general_needs_mismatch"))
end
end

Loading…
Cancel
Save