Browse Source

feat: match email regardless of casing in bulk upload

pull/2017/head
natdeanlewissoftwire 1 year ago
parent
commit
3d02ba90b6
  1. 2
      app/services/bulk_upload/lettings/year2022/row_parser.rb
  2. 2
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  3. 2
      app/services/bulk_upload/sales/year2022/row_parser.rb
  4. 2
      app/services/bulk_upload/sales/year2023/row_parser.rb
  5. 10
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb
  6. 10
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
  7. 10
      spec/services/bulk_upload/sales/year2022/row_parser_spec.rb
  8. 10
      spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

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

@ -513,7 +513,7 @@ private
end
def created_by
@created_by ||= User.find_by(email: field_112)
@created_by ||= User.where("lower(email) = ?", field_112.downcase).first
end
def duplicate_check_fields

2
app/services/bulk_upload/lettings/year2023/row_parser.rb

@ -542,7 +542,7 @@ private
end
def created_by
@created_by ||= User.find_by(email: field_3)
@created_by ||= User.where("lower(email) = ?", field_3.downcase).first
end
def validate_uprn_exists_if_any_key_address_fields_are_blank

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

@ -934,7 +934,7 @@ private
end
def created_by
@created_by ||= User.find_by(email: field_93)
@created_by ||= User.where("lower(email) = ?", field_93.downcase).first
end
def hhregres

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

@ -1112,7 +1112,7 @@ private
end
def created_by
@created_by ||= User.find_by(email: field_2)
@created_by ||= User.where("lower(email) = ?", field_2.downcase).first
end
def previous_la_known

10
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -1125,6 +1125,16 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
end
end
context "when email matches other than casing" do
let(:other_user) { create(:user, organisation: owning_org) }
let(:attributes) { { bulk_upload:, field_111: owning_org.old_visible_id, field_112: other_user.email.upcase!, field_113: managing_org.old_visible_id } }
it "is permitted" do
expect(parser.errors[:field_112]).to be_blank
end
end
context "when an user part of managing org" do
let(:other_user) { create(:user, organisation: managing_org) }

10
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -753,6 +753,16 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
end
end
context "when email matches other than casing" do
let(:other_user) { create(:user, organisation: owning_org) }
let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_3: other_user.email.upcase!, field_2: managing_org.old_visible_id } }
it "is permitted" do
expect(parser.errors[:field_3]).to be_blank
end
end
context "when an user part of managing org" do
let(:other_user) { create(:user, organisation: managing_org) }

10
spec/services/bulk_upload/sales/year2022/row_parser_spec.rb

@ -510,6 +510,16 @@ RSpec.describe BulkUpload::Sales::Year2022::RowParser do
expect(parser.errors[:field_93]).to be_blank
end
end
context "when email matches other than casing" do
let(:other_user) { create(:user, organisation: owning_org) }
let(:attributes) { { bulk_upload:, field_92: owning_org.old_visible_id, field_93: other_user.email.upcase! } }
it "is permitted" do
expect(parser.errors[:field_93]).to be_blank
end
end
end
[

10
spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

@ -459,6 +459,16 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
expect(parser.errors[:field_2]).to be_blank
end
end
context "when email matches other than casing" do
let(:other_user) { create(:user, organisation: owning_org) }
let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: other_user.email.upcase! } }
it "is permitted" do
expect(parser.errors[:field_2]).to be_blank
end
end
end
describe "fields 3, 4, 5 => saledate" do

Loading…
Cancel
Save