Browse Source

CLDC-868 purchase price validations PO review (#1285)

* feat: wip behaviour

* feat: hide in cya

* feat: show in cya

* feat: purchase price range service and rake task

* feat: fix hodate validation and use purchase price ranges

* db:update

* feat: more saledate -> exdate fixing

* feat: add min and max conditional text

* refactor: linting

* refactor: remove duplicated behaviour

* refactor: linting

* feat: update tests

* test: add validation tests

* test: add purchase price rangeimport service tests

* refactor: linting

* feat: allow translation text and title text to display currency formatting even when not a log field

* feat: use i18n

* feat: update i18n

* refactor: pratical -> practical

* refactor: linting

* refactor: revert unnecessary change

* feat: respond to PR comments

* tests: update after merge

* feat: improve currency interruption screen display

* feat: update docs

* feat: fix typo

* feat: missing end after merge

* feat: respond to PR comments

* feat: add soft validation to beds and la pages

* db:update

* feat: revert saledate/exdate work

* feat: revert saledate/exdate work

* feat: revert saledate/exdate work

* feat: revert saledate/exdate work

* feat: revert saledate/exdate work

* feat: PO comment responses

* tests: update

* refactor: linting

* refactor: simplification

* refactor: railsification

* test: fix

* refactor: use number_to_currency units

* refactor: remove duplicated copy

* db:update

* feat: add value check for discounted and outright sale

* feat: rename files

* test: update

* test: update

* test: update

* db: update
pull/1327/head
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
6be860db28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/models/form/sales/pages/about_price_value_check.rb
  2. 2
      app/models/form/sales/questions/about_price_value_check.rb
  3. 1
      app/models/form/sales/subsections/discounted_ownership_scheme.rb
  4. 1
      app/models/form/sales/subsections/outright_sale.rb
  5. 4
      app/models/form/sales/subsections/property_information.rb
  6. 2
      app/models/form/sales/subsections/shared_ownership_scheme.rb
  7. 1
      spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb
  8. 1
      spec/models/form/sales/subsections/outright_sale_spec.rb
  9. 4
      spec/models/form/sales/subsections/property_information_spec.rb
  10. 4
      spec/models/form_handler_spec.rb

4
app/models/form/sales/pages/about_price_shared_ownership_value_check.rb → app/models/form/sales/pages/about_price_value_check.rb

@ -1,4 +1,4 @@
class Form::Sales::Pages::AboutPriceSharedOwnershipValueCheck < ::Form::Page
class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@depends_on = [
@ -34,7 +34,7 @@ class Form::Sales::Pages::AboutPriceSharedOwnershipValueCheck < ::Form::Page
def questions
@questions ||= [
Form::Sales::Questions::AboutPriceSharedOwnershipValueCheck.new(nil, nil, self),
Form::Sales::Questions::AboutPriceValueCheck.new(nil, nil, self),
]
end
end

2
app/models/form/sales/questions/about_price_shared_ownership_value_check.rb → app/models/form/sales/questions/about_price_value_check.rb

@ -1,4 +1,4 @@
class Form::Sales::Questions::AboutPriceSharedOwnershipValueCheck < ::Form::Question
class Form::Sales::Questions::AboutPriceValueCheck < ::Form::Question
def initialize(id, hsh, page)
super
@id = "value_value_check"

1
app/models/form/sales/subsections/discounted_ownership_scheme.rb

@ -14,6 +14,7 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self),
Form::Sales::Pages::GrantValueCheck.new(nil, nil, self),
Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_outright_ownership", nil, self),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_discounted_ownership_value_check", nil, self),
Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_value_and_discount", nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_discounted_ownership", nil, self),
Form::Sales::Pages::MortgageValueCheck.new("discounted_ownership_mortgage_used_mortgage_value_check", nil, self),

1
app/models/form/sales/subsections/outright_sale.rb

@ -9,6 +9,7 @@ class Form::Sales::Subsections::OutrightSale < ::Form::Subsection
def pages
@pages ||= [
Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_outright_sale", nil, self),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_outright_sale_value_check", nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_outright_sale", nil, self),
Form::Sales::Pages::MortgageValueCheck.new("outright_sale_mortgage_used_mortgage_value_check", nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self),

4
app/models/form/sales/subsections/property_information.rb

@ -9,13 +9,13 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection
def pages
@pages ||= [
Form::Sales::Pages::PropertyNumberOfBedrooms.new(nil, nil, self),
Form::Sales::Pages::AboutPriceSharedOwnershipValueCheck.new("about_price_shared_ownership_bedrooms_value_check", nil, self),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_bedrooms_value_check", nil, self),
Form::Sales::Pages::PropertyUnitType.new(nil, nil, self),
Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_property_type_value_check", nil, self),
Form::Sales::Pages::PropertyBuildingType.new(nil, nil, self),
Form::Sales::Pages::Postcode.new(nil, nil, self),
Form::Sales::Pages::PropertyLocalAuthority.new(nil, nil, self),
Form::Sales::Pages::AboutPriceSharedOwnershipValueCheck.new("about_price_shared_ownership_la_value_check", nil, self),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_la_value_check", nil, self),
Form::Sales::Pages::PropertyWheelchairAccessible.new(nil, nil, self),
]
end

2
app/models/form/sales/subsections/shared_ownership_scheme.rb

@ -22,7 +22,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::PreviousPropertyType.new(nil, nil, self),
Form::Sales::Pages::PreviousTenure.new(nil, nil, self),
Form::Sales::Pages::AboutPriceSharedOwnership.new(nil, nil, self),
Form::Sales::Pages::AboutPriceSharedOwnershipValueCheck.new("about_price_shared_ownership_value_check", nil, self),
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_shared_ownership_value_check", nil, self),
Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_equity_value_check", nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_shared_ownership", nil, self),
Form::Sales::Pages::MortgageValueCheck.new("mortgage_used_mortgage_value_check", nil, self),

1
spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb

@ -20,6 +20,7 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model
about_price_not_rtb
grant_value_check
purchase_price_outright_ownership
about_price_discounted_ownership_value_check
discounted_ownership_deposit_and_mortgage_value_check_after_value_and_discount
mortgage_used_discounted_ownership
discounted_ownership_mortgage_used_mortgage_value_check

1
spec/models/form/sales/subsections/outright_sale_spec.rb

@ -15,6 +15,7 @@ RSpec.describe Form::Sales::Subsections::OutrightSale, type: :model do
expect(outright_sale.pages.map(&:id)).to eq(
%w[
purchase_price_outright_sale
about_price_outright_sale_value_check
mortgage_used_outright_sale
outright_sale_mortgage_used_mortgage_value_check
mortgage_amount_outright_sale

4
spec/models/form/sales/subsections/property_information_spec.rb

@ -15,13 +15,13 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do
expect(property_information.pages.map(&:id)).to eq(
%w[
property_number_of_bedrooms
about_price_shared_ownership_bedrooms_value_check
about_price_bedrooms_value_check
property_unit_type
monthly_charges_property_type_value_check
property_building_type
property_postcode
property_local_authority
about_price_shared_ownership_la_value_check
about_price_la_value_check
property_wheelchair_accessible
],
)

4
spec/models/form_handler_spec.rb

@ -54,14 +54,14 @@ RSpec.describe FormHandler do
it "is able to load a current sales form" do
form = form_handler.get_form("current_sales")
expect(form).to be_a(Form)
expect(form.pages.count).to eq(180)
expect(form.pages.count).to eq(182)
expect(form.name).to eq("2022_2023_sales")
end
it "is able to load a previous sales form" do
form = form_handler.get_form("previous_sales")
expect(form).to be_a(Form)
expect(form.pages.count).to eq(180)
expect(form.pages.count).to eq(182)
expect(form.name).to eq("2021_2022_sales")
end
end

Loading…
Cancel
Save