Browse Source

feat: fix bug by making sale date soft validation optional

pull/1259/head
natdeanlewissoftwire 3 years ago
parent
commit
0497dc4c11
  1. 6
      app/models/form/sales/questions/sale_date_check.rb
  2. 2
      app/models/sales_log.rb
  3. 5
      db/migrate/20230203104238_add_saledate_check_to_sales_log.rb
  4. 3
      db/schema.rb

6
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,
},
],
}

2
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

5
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

3
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"

Loading…
Cancel
Save