diff --git a/app/models/form/sales/questions/sale_date_check.rb b/app/models/form/sales/questions/sale_date_check.rb index 4a76c639f..76e0ab8af 100644 --- a/app/models/form/sales/questions/sale_date_check.rb +++ b/app/models/form/sales/questions/sale_date_check.rb @@ -1,7 +1,7 @@ class Form::Sales::Questions::SaleDateCheck < ::Form::Question def initialize(id, hsh, page) super - @id = "hodate_check" + @id = "saledate_check" @check_answer_label = "Completion date check" @header = "Are you sure?" @type = "interruption_screen" @@ -12,10 +12,10 @@ class Form::Sales::Questions::SaleDateCheck < ::Form::Question @hidden_in_check_answers = { "depends_on" => [ { - "hodate_check" => 0, + "saledate_check" => 0, }, { - "hodate_check" => 1, + "saledate_check" => 1, }, ], } diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index b217ff69c..8a99932bd 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -35,7 +35,7 @@ class SalesLog < Log scope :search_by, ->(param) { filter_by_id(param) } scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org) } - OPTIONAL_FIELDS = %w[purchid monthly_charges_value_check old_persons_shared_ownership_value_check].freeze + OPTIONAL_FIELDS = %w[saledate_check purchid monthly_charges_value_check old_persons_shared_ownership_value_check].freeze RETIREMENT_AGES = { "M" => 65, "F" => 60, "X" => 65 }.freeze def startdate diff --git a/db/migrate/20230203104238_add_saledate_check_to_sales_log.rb b/db/migrate/20230203104238_add_saledate_check_to_sales_log.rb new file mode 100644 index 000000000..8ee7fdc65 --- /dev/null +++ b/db/migrate/20230203104238_add_saledate_check_to_sales_log.rb @@ -0,0 +1,5 @@ +class AddSaledateCheckToSalesLog < ActiveRecord::Migration[7.0] + def change + add_column :sales_logs, :saledate_check, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index d107bad1e..99aef7031 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_01_27_102334) do +ActiveRecord::Schema[7.0].define(version: 2023_02_03_104238) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -510,6 +510,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_27_102334) do t.integer "old_persons_shared_ownership_value_check" t.integer "staircase_bought_value_check" t.integer "monthly_charges_value_check" + t.integer "saledate_check" t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id" t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id"