mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-23 07:09:39 +02:00
Fix bug: Loan % doesn't allow exact rate (#1492)
* Fix bug: Loan % doesn't allow exact rate Fixes #1487 Change the step of the interest rate field to 0.005. It's unlikely that we'll see interest rates in smaller increments. * step 0.005 * migration for loan interest rates precision * add new line
This commit is contained in:
parent
571fc4db75
commit
1c2f075053
3 changed files with 9 additions and 4 deletions
|
@ -10,7 +10,7 @@
|
||||||
label: t("loans.form.interest_rate"),
|
label: t("loans.form.interest_rate"),
|
||||||
placeholder: t("loans.form.interest_rate_placeholder"),
|
placeholder: t("loans.form.interest_rate_placeholder"),
|
||||||
min: 0,
|
min: 0,
|
||||||
step: 0.01 %>
|
step: 0.005 %>
|
||||||
<%= loan_form.select :rate_type,
|
<%= loan_form.select :rate_type,
|
||||||
[["Fixed", "fixed"], ["Variable", "variable"], ["Adjustable", "adjustable"]],
|
[["Fixed", "fixed"], ["Variable", "variable"], ["Adjustable", "adjustable"]],
|
||||||
{ label: t("loans.form.rate_type") } %>
|
{ label: t("loans.form.rate_type") } %>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ChangeLoanInterestRatePrecision < ActiveRecord::Migration[7.2]
|
||||||
|
def change
|
||||||
|
change_column :loans, :interest_rate, :decimal, precision: 10, scale: 3
|
||||||
|
end
|
||||||
|
end
|
6
db/schema.rb
generated
6
db/schema.rb
generated
|
@ -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.2].define(version: 2024_11_14_164118) do
|
ActiveRecord::Schema[7.2].define(version: 2024_11_22_183828) 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 "pgcrypto"
|
enable_extension "pgcrypto"
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -107,7 +107,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_14_164118) do
|
||||||
t.decimal "balance", precision: 19, scale: 4
|
t.decimal "balance", precision: 19, scale: 4
|
||||||
t.string "currency"
|
t.string "currency"
|
||||||
t.boolean "is_active", default: true, null: false
|
t.boolean "is_active", default: true, null: false
|
||||||
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY ((ARRAY['Loan'::character varying, 'CreditCard'::character varying, 'OtherLiability'::character varying])::text[])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
|
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY (ARRAY[('Loan'::character varying)::text, ('CreditCard'::character varying)::text, ('OtherLiability'::character varying)::text])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
|
||||||
t.uuid "import_id"
|
t.uuid "import_id"
|
||||||
t.uuid "plaid_account_id"
|
t.uuid "plaid_account_id"
|
||||||
t.boolean "scheduled_for_deletion", default: false
|
t.boolean "scheduled_for_deletion", default: false
|
||||||
|
@ -439,7 +439,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_14_164118) do
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.string "rate_type"
|
t.string "rate_type"
|
||||||
t.decimal "interest_rate", precision: 10, scale: 2
|
t.decimal "interest_rate", precision: 10, scale: 3
|
||||||
t.integer "term_months"
|
t.integer "term_months"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue