Browse Source

feat: add question and page and update db

pull/1163/head
natdeanlewissoftwire 3 years ago
parent
commit
8acf5ce048
  1. 14
      app/models/form/sales/pages/mortgage_length.rb
  2. 14
      app/models/form/sales/questions/mortgage_length.rb
  3. 1
      app/models/form/sales/subsections/discounted_ownership_scheme.rb
  4. 1
      app/models/form/sales/subsections/outright_sale.rb
  5. 1
      app/models/form/sales/subsections/shared_ownership_scheme.rb
  6. 7
      db/migrate/20230109160738_add_mortlen_to_sales_logs.rb
  7. 3
      db/schema.rb

14
app/models/form/sales/pages/mortgage_length.rb

@ -0,0 +1,14 @@
class Form::Sales::Pages::MortgageLength < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::MortgageLength.new(nil, nil, self),
]
end
end

14
app/models/form/sales/questions/mortgage_length.rb

@ -0,0 +1,14 @@
class Form::Sales::Questions::MortgageLength < ::Form::Question
def initialize(id, hsh, page)
super
@id = "mortlen"
@check_answer_label = " Length of mortgage"
@header = "What is the length of the mortgage?"
@type = "numeric"
@page = page
@min = 0
@width = 5
@suffix = " years"
@hint_text = ""
end
end

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::AboutPriceNotRtb.new(nil, nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_discounted_ownership", nil, self), Form::Sales::Pages::Mortgageused.new("mortgage_used_discounted_ownership", nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_discounted_ownership", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_discounted_ownership", nil, self),
Form::Sales::Pages::MortgageLength.new("mortgage_length_discounted_ownership", nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self),
Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_value_check", nil, self),
Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_discounted_ownership", nil, self), Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_discounted_ownership", nil, self),

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

@ -12,6 +12,7 @@ class Form::Sales::Subsections::OutrightSale < ::Form::Subsection
Form::Sales::Pages::PurchasePrice.new(nil, nil, self), Form::Sales::Pages::PurchasePrice.new(nil, nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_outright_sale", nil, self), Form::Sales::Pages::Mortgageused.new("mortgage_used_outright_sale", nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self),
Form::Sales::Pages::MortgageLength.new("mortgage_length_outright_sale_ownership", nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self),
Form::Sales::Pages::DepositValueCheck.new("outright_sale_deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("outright_sale_deposit_value_check", nil, self),
Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_outright_sale", nil, self), Form::Sales::Pages::LeaseholdCharges.new("leasehold_charges_outright_sale", nil, self),

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

@ -20,6 +20,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::AboutPriceSharedOwnership.new(nil, nil, self), Form::Sales::Pages::AboutPriceSharedOwnership.new(nil, nil, self),
Form::Sales::Pages::Mortgageused.new("mortgage_used_shared_ownership", nil, self), Form::Sales::Pages::Mortgageused.new("mortgage_used_shared_ownership", nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_shared_ownership", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_shared_ownership", nil, self),
Form::Sales::Pages::MortgageLength.new("mortgage_length_shared_ownership", nil, self),
Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self), Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self),
Form::Sales::Pages::DepositValueCheck.new("shared_ownership_deposit_value_check", nil, self), Form::Sales::Pages::DepositValueCheck.new("shared_ownership_deposit_value_check", nil, self),

7
db/migrate/20230109160738_add_mortlen_to_sales_logs.rb

@ -0,0 +1,7 @@
class AddMortlenToSalesLogs < ActiveRecord::Migration[7.0]
def change
change_table :sales_logs, bulk: true do |t|
t.column :mortlen, :integer
end
end
end

3
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_01_05_103733) do ActiveRecord::Schema[7.0].define(version: 2023_01_09_160738) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -466,6 +466,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_05_103733) do
t.string "sex4" t.string "sex4"
t.string "sex5" t.string "sex5"
t.string "sex6" t.string "sex6"
t.integer "mortlen"
t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id"
t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id" t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id"
t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id"

Loading…
Cancel
Save