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
e7b08d1e35
  1. 3
      app/helpers/bulk_upload/sales_log_to_csv.rb
  2. 2
      app/services/bulk_upload/sales/validator.rb
  3. 1
      app/services/bulk_upload/sales/year2026/csv_parser.rb
  4. 8
      db/schema.rb

3
app/helpers/bulk_upload/sales_log_to_csv.rb

@ -70,8 +70,7 @@ class BulkUpload::SalesLogToCsv
when 2025
(1..121).to_a
when 2026
# TODO: CLDC-4162: Replace with actual field numbers when 2026 format is known
(1..121).to_a
(1..BulkUpload::Lettings::Year2026::CsvParser::FIELDS).to_a
else
raise NotImplementedError "No mapping function implemented for year #{year}"
end

2
app/services/bulk_upload/sales/validator.rb

@ -167,7 +167,7 @@ private
column_count = rows.map(&:size).max
errors.add(:base, I18n.t("validations.sales.#{@bulk_upload.year}.bulk_upload.wrong_template.over_max_column_count")) if column_count > csv_parser.class::MAX_COLUMNS
errors.add(:base, I18n.t("validations.sales.#{@bulk_upload.year}.bulk_upload.wrong_template.over_max_column_count")) if column_count > csv_parser.class::FIELDS + 1
end
def validate_correct_template

1
app/services/bulk_upload/sales/year2026/csv_parser.rb

@ -5,7 +5,6 @@ class BulkUpload::Sales::Year2026::CsvParser
# TODO: CLDC-4162: Update when 2026 format is known
FIELDS = 127
MAX_COLUMNS = FIELDS + 1
FORM_YEAR = 2026
attr_reader :path

8
db/schema.rb

@ -376,14 +376,6 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_28_121417) do
t.boolean "manual_address_entry_selected", default: false
t.integer "referral_type"
t.integer "working_situation_illness_check"
t.string "sexrab1"
t.string "sexrab2"
t.string "sexrab3"
t.string "sexrab4"
t.string "sexrab5"
t.string "sexrab6"
t.string "sexrab7"
t.string "sexrab8"
t.index ["assigned_to_id"], name: "index_lettings_logs_on_assigned_to_id"
t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id"
t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id"

Loading…
Cancel
Save