Browse Source

Merge branch 'CLDC-4177-sales-sab-question' into CLDC-4141-lettings-sab-question

pull/3171/head
Nat Dean-Lewis 1 week ago
parent
commit
e642813d31
  1. 2
      app/helpers/bulk_upload/sales_log_to_csv.rb
  2. 16
      docs/Gemfile.lock
  3. 6
      spec/fixtures/variable_definitions/sales_download_26_27.csv
  4. 2
      spec/lib/tasks/log_variable_definitions_spec.rb
  5. 8
      spec/services/bulk_upload/sales/year2026/csv_parser_spec.rb

2
app/helpers/bulk_upload/sales_log_to_csv.rb

@ -70,7 +70,7 @@ class BulkUpload::SalesLogToCsv
when 2025 when 2025
(1..121).to_a (1..121).to_a
when 2026 when 2026
(1..BulkUpload::Lettings::Year2026::CsvParser::FIELDS).to_a (1..BulkUpload::Sales::Year2026::CsvParser::FIELDS).to_a
else else
raise NotImplementedError "No mapping function implemented for year #{year}" raise NotImplementedError "No mapping function implemented for year #{year}"
end end

16
docs/Gemfile.lock

@ -24,10 +24,12 @@ GEM
ffi (>= 1.15.0) ffi (>= 1.15.0)
eventmachine (1.2.7) eventmachine (1.2.7)
execjs (2.8.1) execjs (2.8.1)
faraday (2.7.4) faraday (2.14.1)
faraday-net_http (>= 2.0, < 3.1) faraday-net_http (>= 2.0, < 3.5)
ruby2_keywords (>= 0.0.4) json
faraday-net_http (3.0.2) logger
faraday-net_http (3.4.2)
net-http (~> 0.5)
ffi (1.15.5) ffi (1.15.5)
forwardable-extended (2.6.0) forwardable-extended (2.6.0)
gemoji (3.0.1) gemoji (3.0.1)
@ -196,6 +198,7 @@ GEM
gemoji (~> 3.0) gemoji (~> 3.0)
html-pipeline (~> 2.2) html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0) jekyll (>= 3.0, < 5.0)
json (2.18.1)
kramdown (2.3.2) kramdown (2.3.2)
rexml rexml
kramdown-parser-gfm (1.1.0) kramdown-parser-gfm (1.1.0)
@ -204,12 +207,15 @@ GEM
listen (3.8.0) listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
mercenary (0.3.6) mercenary (0.3.6)
minima (2.5.1) minima (2.5.1)
jekyll (>= 3.5, < 5.0) jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9) jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1) jekyll-seo-tag (~> 2.1)
minitest (5.19.0) minitest (5.19.0)
net-http (0.9.1)
uri (>= 0.11.1)
nokogiri (1.18.9-arm64-darwin) nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.18.9-x86_64-darwin) nokogiri (1.18.9-x86_64-darwin)
@ -228,7 +234,6 @@ GEM
ffi (~> 1.0) ffi (~> 1.0)
rexml (3.4.2) rexml (3.4.2)
rouge (3.26.0) rouge (3.26.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2) rubyzip (2.3.2)
safe_yaml (1.0.5) safe_yaml (1.0.5)
sass (3.7.4) sass (3.7.4)
@ -251,6 +256,7 @@ GEM
unf_ext unf_ext
unf_ext (0.0.8.2) unf_ext (0.0.8.2)
unicode-display_width (1.8.0) unicode-display_width (1.8.0)
uri (1.1.1)
webrick (1.8.2) webrick (1.8.2)
PLATFORMS PLATFORMS

6
spec/fixtures/variable_definitions/sales_download_26_27.csv vendored

@ -279,3 +279,9 @@ has_mscharge,Does the property have any monthly leasehold charges?
mscharge,What are the total monthly leasehold charges for the property? mscharge,What are the total monthly leasehold charges for the property?
discount,What was the percentage discount? discount,What was the percentage discount?
grant,What was the amount of any loan, grant, discount or subsidy given? grant,What was the amount of any loan, grant, discount or subsidy given?
sexrab1,What was buyer 1's sex at birth?,,,
sexrab2,What was buyer/person 2's sex at birth?,,,
sexrab3,What was person 3's sex at birth?,,,
sexrab4,What was person 4's sex at birth?,,,
sexrab5,What was person 5's sex at birth?,,,
sexrab6,What was person 6's sex at birth?,,,

Can't render this file because it has a wrong number of fields in line 20.

2
spec/lib/tasks/log_variable_definitions_spec.rb

@ -6,7 +6,7 @@ RSpec.describe "log_variable_definitions" do
subject(:task) { Rake::Task["data_import:add_variable_definitions"] } subject(:task) { Rake::Task["data_import:add_variable_definitions"] }
let(:path) { "spec/fixtures/variable_definitions" } let(:path) { "spec/fixtures/variable_definitions" }
let(:total_variable_definitions_count) { 425 } let(:total_variable_definitions_count) { 427 }
before do before do
Rake.application.rake_require("tasks/log_variable_definitions") Rake.application.rake_require("tasks/log_variable_definitions")

8
spec/services/bulk_upload/sales/year2026/csv_parser_spec.rb

@ -15,8 +15,8 @@ RSpec.describe BulkUpload::Sales::Year2026::CsvParser do
file.write("Can be empty?\n") file.write("Can be empty?\n")
file.write("Type of letting the question applies to\n") file.write("Type of letting the question applies to\n")
file.write("Duplicate check field?\n") file.write("Duplicate check field?\n")
file.write(BulkUpload::SalesLogToCsv.new(log:).default_field_numbers_row_for_year(2025)) file.write(BulkUpload::SalesLogToCsv.new(log:).default_field_numbers_row_for_year(2026))
file.write(BulkUpload::SalesLogToCsv.new(log:).to_year_csv_row(2025)) file.write(BulkUpload::SalesLogToCsv.new(log:).to_year_csv_row(2026))
file.write("\n") file.write("\n")
file.rewind file.rewind
end end
@ -81,8 +81,8 @@ RSpec.describe BulkUpload::Sales::Year2026::CsvParser do
file.write("Can be empty?\n") file.write("Can be empty?\n")
file.write("Type of letting the question applies to\n") file.write("Type of letting the question applies to\n")
file.write("Duplicate check field?\n") file.write("Duplicate check field?\n")
file.write(BulkUpload::SalesLogToCsv.new(log:).default_field_numbers_row_for_year(2025, seed:)) file.write(BulkUpload::SalesLogToCsv.new(log:).default_field_numbers_row_for_year(2026, seed:))
file.write(BulkUpload::SalesLogToCsv.new(log:).to_year_csv_row(2025, seed:)) file.write(BulkUpload::SalesLogToCsv.new(log:).to_year_csv_row(2026, seed:))
file.rewind file.rewind
end end

Loading…
Cancel
Save