diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 48baa7b8e..6f3ce1cec 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -56,7 +56,7 @@ class LettingsLog < Log scope :duplicate_logs, lambda { |log| visible.where(log.slice(*DUPLICATE_LOG_ATTRIBUTES)) .where.not(id: log.id) - .where.not("startdate IS NULL OR age1 IS NULL OR sex1 IS NULL OR ecstat1 IS NULL OR tcharge IS NULL OR postcode_full IS NULL OR propcode IS NULL OR needstype IS NULL") + .where.not("startdate IS NULL OR age1 IS NULL OR sex1 IS NULL OR ecstat1 IS NULL OR tcharge IS NULL OR postcode_full IS NULL OR needstype IS NULL") .where("location_id = ? OR needstype = 1", log.location_id) } @@ -67,7 +67,7 @@ class LettingsLog < Log NUM_OF_WEEKS_FROM_PERIOD = { 2 => 26, 3 => 13, 4 => 12, 5 => 50, 6 => 49, 7 => 48, 8 => 47, 9 => 46, 1 => 52, 10 => 53 }.freeze SUFFIX_FROM_PERIOD = { 2 => "every 2 weeks", 3 => "every 4 weeks", 4 => "every month" }.freeze RETIREMENT_AGES = { "M" => 67, "F" => 60, "X" => 67 }.freeze - DUPLICATE_LOG_ATTRIBUTES = %w[tenancycode propcode startdate age1 sex1 ecstat1 tcharge postcode_full].freeze + DUPLICATE_LOG_ATTRIBUTES = %w[tenancycode startdate age1 sex1 ecstat1 tcharge postcode_full].freeze def form FormHandler.instance.get_form(form_name) || FormHandler.instance.current_lettings_form diff --git a/app/services/bulk_upload/lettings/year2022/row_parser.rb b/app/services/bulk_upload/lettings/year2022/row_parser.rb index a1e7dbb06..642c8efe8 100644 --- a/app/services/bulk_upload/lettings/year2022/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2022/row_parser.rb @@ -450,7 +450,6 @@ class BulkUpload::Lettings::Year2022::RowParser "field_96", # startdate "field_97", # startdate "field_98", # startdate - "field_100", # propcode bulk_upload.needstype != 2 ? "field_108" : nil, # postcode bulk_upload.needstype != 2 ? "field_109" : nil, # postcode "field_111", # owning org @@ -525,7 +524,6 @@ private "ecstat1", "owning_organisation", "tcharge", - "propcode", bulk_upload.needstype != 2 ? "postcode_full" : nil, bulk_upload.needstype != 1 ? "location" : nil, ].compact @@ -862,7 +860,6 @@ private errors.add(:field_96, error_message) # startdate errors.add(:field_97, error_message) # startdate errors.add(:field_98, error_message) # startdate - errors.add(:field_100, error_message) # propcode errors.add(:field_108, error_message) if bulk_upload.needstype != 2 # postcode_full errors.add(:field_109, error_message) if bulk_upload.needstype != 2 # postcode_full errors.add(:field_111, error_message) # owning_organisation diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 11e9a1e5b..4a12e9083 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -464,7 +464,6 @@ class BulkUpload::Lettings::Year2023::RowParser "field_8", # startdate "field_9", # startdate "field_13", # tenancycode - "field_14", # propcode field_4 != 1 ? "field_17" : nil, # location field_4 != 2 ? "field_23" : nil, # postcode field_4 != 2 ? "field_24" : nil, # postcode @@ -561,7 +560,6 @@ private "ecstat1", "owning_organisation", "tcharge", - "propcode", field_4 != 2 ? "postcode_full" : nil, field_4 != 1 ? "location" : nil, "tenancycode", @@ -856,7 +854,6 @@ private errors.add(:field_8, error_message) # startdate errors.add(:field_9, error_message) # startdate errors.add(:field_13, error_message) # tenancycode - errors.add(:field_14, error_message) # propcode errors.add(:field_17, error_message) if field_4 != 1 # location errors.add(:field_23, error_message) if field_4 != 2 # postcode_full errors.add(:field_24, error_message) if field_4 != 2 # postcode_full diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb index b5b5e99cb..4912ebbe6 100644 --- a/spec/models/lettings_log_spec.rb +++ b/spec/models/lettings_log_spec.rb @@ -2862,14 +2862,6 @@ RSpec.describe LettingsLog do end end - context "when there is a log with a different propcode" do - let!(:different_propcode) { create(:lettings_log, :duplicate, propcode: "different") } - - it "does not return a log with a different propcode as a duplicate" do - expect(described_class.duplicate_logs(log)).not_to include(different_propcode) - end - end - context "when there is a log with a different tenancycode" do let!(:different_tenancycode) { create(:lettings_log, :duplicate, tenancycode: "different") } @@ -2887,10 +2879,10 @@ RSpec.describe LettingsLog do end context "when there is a log with nil values for duplicate check fields" do - let!(:duplicate_check_fields_not_given) { create(:lettings_log, :duplicate, age1: nil, sex1: nil, ecstat1: nil, propcode: nil, postcode_known: 2, postcode_full: nil) } + let!(:duplicate_check_fields_not_given) { create(:lettings_log, :duplicate, age1: nil, sex1: nil, ecstat1: nil, postcode_known: 2, postcode_full: nil) } it "does not return a log with nil values as a duplicate" do - log.update!(age1: nil, sex1: nil, ecstat1: nil, propcode: nil, postcode_known: 2, postcode_full: nil) + log.update!(age1: nil, sex1: nil, ecstat1: nil, postcode_known: 2, postcode_full: nil) expect(described_class.duplicate_logs(log)).not_to include(duplicate_check_fields_not_given) end end diff --git a/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb index 4d2c28ee8..b91caa969 100644 --- a/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb @@ -258,7 +258,6 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do field_96: [error_message], # startdate field_97: [error_message], # startdate field_98: [error_message], # startdate - field_100: [error_message], # propcode field_108: [error_message], # postcode_full field_109: [error_message], # postcode_full field_111: [error_message], # owning_organisation @@ -295,7 +294,6 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do :field_96, # startdate :field_97, # startdate :field_98, # startdate - :field_100, # propcode :field_111, # owning_organisation ].each do |field| expect(parser.errors[field]).to include("This is a duplicate log") @@ -329,7 +327,6 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do :field_96, # startdate :field_97, # startdate :field_98, # startdate - :field_100, # propcode :field_108, # postcode_full :field_109, # postcode_full :field_111, # owning_organisation diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index e177eb859..09dc8d226 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -328,7 +328,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do :field_8, # startdate :field_9, # startdate :field_13, # tenancycode - :field_14, # propcode :field_17, # location :field_46, # age1 :field_47, # sex1 @@ -363,7 +362,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do :field_7, # startdate :field_8, # startdate :field_9, # startdate - :field_14, # propcode :field_17, # location :field_23, # postcode_full :field_24, # postcode_full