Browse Source

Remove soft validations from sales setup and make them mandatory

pull/1645/head
Kat 3 years ago
parent
commit
426667e891
  1. 6
      app/models/form/sales/subsections/setup.rb
  2. 2
      app/models/sales_log.rb
  3. 6
      spec/models/form/sales/subsections/setup_spec.rb

6
app/models/form/sales/subsections/setup.rb

@ -10,17 +10,11 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection
Form::Common::Pages::Organisation.new(nil, nil, self),
Form::Sales::Pages::CreatedBy.new(nil, nil, self),
Form::Sales::Pages::SaleDate.new(nil, nil, self),
Form::Sales::Pages::SaleDateCheck.new(nil, nil, self),
Form::Sales::Pages::PurchaserCode.new(nil, nil, self),
Form::Sales::Pages::OwnershipScheme.new(nil, nil, self),
Form::Sales::Pages::SharedOwnershipType.new(nil, nil, self),
Form::Sales::Pages::DiscountedOwnershipType.new(nil, nil, self),
Form::Sales::Pages::OutrightOwnershipType.new(nil, nil, self),
Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck.new("ownership_type_old_persons_shared_ownership_value_check", nil, self),
Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_type_value_check", nil, self),
Form::Sales::Pages::DiscountedSaleValueCheck.new("discounted_sale_type_value_check", nil, self),
Form::Sales::Pages::BuyerLiveInValueCheck.new("buyer_1_live_in_property_type_value_check", nil, self, person_index: 1),
Form::Sales::Pages::BuyerLiveInValueCheck.new("buyer_2_live_in_property_type_value_check", nil, self, person_index: 2),
Form::Sales::Pages::BuyerCompany.new(nil, nil, self),
Form::Sales::Pages::BuyerLive.new(nil, nil, self),
Form::Sales::Pages::JointPurchase.new(nil, nil, self),

2
app/models/sales_log.rb

@ -42,7 +42,7 @@ class SalesLog < Log
}
scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org) }
OPTIONAL_FIELDS = %w[saledate_check purchid monthly_charges_value_check old_persons_shared_ownership_value_check othtype discounted_sale_value_check buyer_livein_value_check].freeze
OPTIONAL_FIELDS = %w[purchid othtype].freeze
RETIREMENT_AGES = { "M" => 65, "F" => 60, "X" => 65 }.freeze
def lettings?

6
spec/models/form/sales/subsections/setup_spec.rb

@ -17,17 +17,11 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do
organisation
created_by
completion_date
completion_date_check
purchaser_code
ownership_scheme
shared_ownership_type
discounted_ownership_type
outright_ownership_type
ownership_type_old_persons_shared_ownership_value_check
monthly_charges_type_value_check
discounted_sale_type_value_check
buyer_1_live_in_property_type_value_check
buyer_2_live_in_property_type_value_check
buyer_company
buyer_live
joint_purchase

Loading…
Cancel
Save