From 2b8baab1e34c43d76b0f21231fc75200606794f1 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Thu, 31 Oct 2024 10:34:11 +0000 Subject: [PATCH] CLDC-3704: Allow equity/stairowned/stairbought to have 1 decimal place --- app/models/form/sales/questions/equity.rb | 2 +- app/models/form/sales/questions/staircase_bought.rb | 2 +- app/models/form/sales/questions/staircase_owned.rb | 2 +- ...241031102744_allow_decimal_stairbought_and_stairowned.rb | 6 ++++++ db/schema.rb | 6 +++--- 5 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20241031102744_allow_decimal_stairbought_and_stairowned.rb diff --git a/app/models/form/sales/questions/equity.rb b/app/models/form/sales/questions/equity.rb index 2e1ad4dee..c6578f969 100644 --- a/app/models/form/sales/questions/equity.rb +++ b/app/models/form/sales/questions/equity.rb @@ -7,7 +7,7 @@ class Form::Sales::Questions::Equity < ::Form::Question @type = "numeric" @min = 0 @max = 100 - @step = 1 + @step = 0.1 @width = 5 @suffix = "%" @hint_text = "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" diff --git a/app/models/form/sales/questions/staircase_bought.rb b/app/models/form/sales/questions/staircase_bought.rb index 0a6343db4..5218ca297 100644 --- a/app/models/form/sales/questions/staircase_bought.rb +++ b/app/models/form/sales/questions/staircase_bought.rb @@ -8,7 +8,7 @@ class Form::Sales::Questions::StaircaseBought < ::Form::Question @width = 5 @min = 0 @max = 100 - @step = 1 + @step = 0.1 @suffix = "%" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] @top_guidance_partial = "financial_calculations_shared_ownership" diff --git a/app/models/form/sales/questions/staircase_owned.rb b/app/models/form/sales/questions/staircase_owned.rb index 64614e608..04403771e 100644 --- a/app/models/form/sales/questions/staircase_owned.rb +++ b/app/models/form/sales/questions/staircase_owned.rb @@ -8,7 +8,7 @@ class Form::Sales::Questions::StaircaseOwned < ::Form::Question @width = 5 @min = 0 @max = 100 - @step = 1 + @step = 0.1 @suffix = "%" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end diff --git a/db/migrate/20241031102744_allow_decimal_stairbought_and_stairowned.rb b/db/migrate/20241031102744_allow_decimal_stairbought_and_stairowned.rb new file mode 100644 index 000000000..50bdd5fd3 --- /dev/null +++ b/db/migrate/20241031102744_allow_decimal_stairbought_and_stairowned.rb @@ -0,0 +1,6 @@ +class AllowDecimalStairboughtAndStairowned < ActiveRecord::Migration[7.0] + def change + change_column :sales_logs, :stairbought, :decimal + change_column :sales_logs, :stairowned, :decimal + end +end diff --git a/db/schema.rb b/db/schema.rb index 84bf048af..ef635628c 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: 2024_10_11_112158) do +ActiveRecord::Schema[7.0].define(version: 2024_10_31_102744) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -627,8 +627,8 @@ ActiveRecord::Schema[7.0].define(version: 2024_10_11_112158) do t.integer "deposit_value_check" t.integer "frombeds" t.integer "staircase" - t.integer "stairbought" - t.integer "stairowned" + t.decimal "stairbought" + t.decimal "stairowned" t.decimal "mrent", precision: 10, scale: 2 t.datetime "exdate" t.integer "exday"