Browse Source

Merge branch 'main' into CLDC-3664-extract-income-and-benefits-copy

pull/2709/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
a408108c6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      app/models/forms/bulk_upload_lettings/guidance.rb
  2. 7
      app/models/forms/bulk_upload_sales/guidance.rb
  3. 4
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  4. 4
      app/services/bulk_upload/sales/year2024/row_parser.rb
  5. 2
      config/credentials.yml.enc
  6. 17
      spec/models/forms/bulk_upload_lettings/guidance_spec.rb
  7. 17
      spec/models/forms/bulk_upload_sales/guidance_spec.rb
  8. 8
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

7
app/models/forms/bulk_upload_lettings/guidance.rb

@ -4,11 +4,18 @@ module Forms
include ActiveModel::Model
include ActiveModel::Attributes
include Rails.application.routes.url_helpers
include CollectionTimeHelper
attribute :year, :integer
attribute :referrer
attribute :organisation_id, :integer
def initialize(params)
super(params)
self.year = current_collection_start_year if year.nil?
end
def view_path
"bulk_upload_shared/guidance"
end

7
app/models/forms/bulk_upload_sales/guidance.rb

@ -4,11 +4,18 @@ module Forms
include ActiveModel::Model
include ActiveModel::Attributes
include Rails.application.routes.url_helpers
include CollectionTimeHelper
attribute :year, :integer
attribute :referrer
attribute :organisation_id, :integer
def initialize(params)
super(params)
self.year = current_collection_start_year if year.nil?
end
def view_path
"bulk_upload_shared/guidance"
end

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

@ -618,7 +618,7 @@ private
end
def key_address_fields_provided?
field_17.present? && field_19.present? && field_21.present? && field_22.present?
field_17.present? && field_19.present? && postcode_full.present?
end
def validate_address_fields
@ -1355,7 +1355,7 @@ private
end
def postcode_full
"#{field_21} #{field_22}" if field_21 && field_22
[field_21, field_22].compact_blank.join(" ") if field_21 || field_22
end
def owning_organisation

4
app/services/bulk_upload/sales/year2024/row_parser.rb

@ -616,7 +616,7 @@ private
end
def key_address_fields_provided?
field_23.present? && field_25.present? && field_27.present? && field_28.present?
field_23.present? && field_25.present? && postcode_full.present?
end
def validate_address_fields
@ -1074,7 +1074,7 @@ private
end
def postcode_full
"#{field_27} #{field_28}" if field_27 && field_28
[field_27, field_28].compact_blank.join(" ") if field_27 || field_28
end
def ppostcode_full

2
config/credentials.yml.enc

@ -1 +1 @@
QGn9IiI91BaO4IGAtfy92FrNP46X9T2jJErRv+o/PRG9LrimEGeuOE+FwhArKZQ5cTipaDqo8u9Ajv45Kitv3c0GynOOvz0r3OjPRHO/p4hW8BFWQDv581cWWPsyZT2JO51zZ5LnwNFvWrjEB2q49YESgtfADPkJWmtx/By5Cg2/PVIRxvhGKOnheme5cih050wqg/43BdiF0PD9FDTZXJDLJg/QQ8nQYkvQe2jN4nM4mTVpkQkmzDKgGknmUWFfW3qWFzlsdMkdkPdeP9wLnJVbFTeyaaJT3wv6l19d2rKqo8iVvacdaQjRev+LVXqOsNAjVHwcPNQVq9s8pxG24HLk3aQ14Eyjf6tHAuZAV4jLnNqQtBQ0AIldWeOl6SKmlTom1P1tcLp9KpajEADplmWSwUktIGmaakFjk/ApYaUBiYTku2iLHMrT/xSc3jPj5W/ZggeJ0Ij6nuGYE1cmBxWGxda9PzOrDP8coEK9vPHiNeDDM1RoukVmf8gwDmshILi5EwIAsO2gJXM1wtPYMu41+H4/y3c0GIwgfv9QP11q+nqhG1MMcOrAUKGhypAS+M+uLwfGQudfQDKP9Zv3VCnOk3mkKlpIzMMD4UdJxQeE/8sfwIsEhWggEo3oa93ptbRdvJ7YYcVvmMmkVBxk0KWFprl4i/BkFHLWrKNl5LBOGA==--ziMOTnYBB5TDyXYU--3FJMs8e6R8lheqcqB8p8uQ==
M2+y4Ll2PwjN9IiCvliQ5Ytiy+/9bSepV2siwg6hvttLc63q0W4hbNobseAZAYqWLajrnJ7lm9AfT8CuBreHtwFsdQ/HV8NPrvzLB/P+X15MKLtb1Sg7bNjtW24uoE3zYrWILecpNygLc1ZXxgjka3yjc7XdV7MA3NR2/2zvkGREJvjbJlEn7036CWnNfN7PD0S57O1z+LqilrrhecWAmGeJRU2Ve2UZNoUExz865ovpk1enGReiU5+0jlNTIK3SCc75HH3grET6HkAbzsZvC763OkEkEQGVJeaytQ2cGkyk8t98nqGRq6fK9uAwKyGh6KwHH8BT++OOF3Re4Uf2A9boFdJ5AOwuV7ZK+OonPu7x/bThRmb+Sl057+L1pSrpILvFUzA3K8k34G9ZMHMLIX0/rHLEav+ToFFwBxARleiUdSgEv9txP0wU+7fPyuJlHJb7CIrC9dRQIeyM9RAIvxZYhP2KrTqm9eEyCJNttAWpYnXfnoxgbQEoQw94KOal/i26bK09TZNwv10oTYZqxB6PqfsQQ9wVIesO9v6uK3HQ2jVXeCb4caj1HWFOjFLhcDoAEFe6DUmjSdxf2tDQ90pwQKQ7IWi9jPOOQSVQ7VoCc1uD3cImDjsY/04sGbCdSpGt53E3Rn9UCGHdVhzzOXRhU4wQLBFEFin79KJ7q0m71jesGEpVNKI2s8aC+Ux8btSBu92JLS4b9zZHT13D729CW2T8--EZ5GxuRKaFfGdzCE--OZ1EwaObJ4ZF59N0JcJ7Dg==

17
spec/models/forms/bulk_upload_lettings/guidance_spec.rb

@ -6,6 +6,7 @@ RSpec.describe Forms::BulkUploadLettings::Guidance do
subject(:bu_guidance) { described_class.new(year:, referrer:) }
let(:year) { 2024 }
let(:referrer) { nil }
describe "#back_path" do
context "when referrer is prepare-your-file" do
@ -40,4 +41,20 @@ RSpec.describe Forms::BulkUploadLettings::Guidance do
end
end
end
describe "year" do
context "when year is not provided" do
let(:year) { nil }
before do
# rubocop:disable RSpec/AnyInstance
allow_any_instance_of(CollectionTimeHelper).to receive(:current_collection_start_year).and_return(2030)
# rubocop:enable RSpec/AnyInstance
end
it "is set to the current collection start year" do
expect(bu_guidance.year).to eq(2030)
end
end
end
end

17
spec/models/forms/bulk_upload_sales/guidance_spec.rb

@ -6,6 +6,7 @@ RSpec.describe Forms::BulkUploadSales::Guidance do
subject(:bu_guidance) { described_class.new(year:, referrer:) }
let(:year) { 2024 }
let(:referrer) { nil }
describe "#back_path" do
context "when referrer is prepare-your-file" do
@ -40,4 +41,20 @@ RSpec.describe Forms::BulkUploadSales::Guidance do
end
end
end
describe "year" do
context "when year is not provided" do
let(:year) { nil }
before do
# rubocop:disable RSpec/AnyInstance
allow_any_instance_of(CollectionTimeHelper).to receive(:current_collection_start_year).and_return(2030)
# rubocop:enable RSpec/AnyInstance
end
it "is set to the current collection start year" do
expect(bu_guidance.year).to eq(2030)
end
end
end
end

8
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -2718,6 +2718,14 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "strips whitespace" do
expect(parser.log.postcode_full).to eql("EC1N 2TD")
end
context "when a partial postcode is provided" do
let(:attributes) { { bulk_upload:, field_4: 1, field_21: "EC1N", field_22: "" } }
it "is set to the partial value" do
expect(parser.log.postcode_full).to eql("EC1N")
end
end
end
describe "#la" do

Loading…
Cancel
Save