The personal finance app for everyone
Fix bug: Loan % doesn't allow exact rate (#1492)
Arsen Shkrumelyak1c2f07505316
diff --git a/app/views/loans/_form.html.erb b/app/views/loans/_form.html.erbindex bfadda90..bceee968 100644--- a/app/views/loans/_form.html.erb+++ b/app/views/loans/_form.html.erb@@ -10,7 +10,7 @@label: t("loans.form.interest_rate"),placeholder: t("loans.form.interest_rate_placeholder"),min: 0,- step: 0.01 %>+ step: 0.005 %><%= loan_form.select :rate_type,[["Fixed", "fixed"], ["Variable", "variable"], ["Adjustable", "adjustable"]],{ label: t("loans.form.rate_type") } %>diff --git a/db/migrate/20241122183828_change_loan_interest_rate_precision.rb.rb b/db/migrate/20241122183828_change_loan_interest_rate_precision.rb.rbnew file mode 100644index 00000000..45a5d59e--- /dev/null+++ b/db/migrate/20241122183828_change_loan_interest_rate_precision.rb.rb@@ -0,0 +1,5 @@+class ChangeLoanInterestRatePrecision < ActiveRecord::Migration[7.2]+ def change+ change_column :loans, :interest_rate, :decimal, precision: 10, scale: 3+ end+enddiff --git a/db/schema.rb b/db/schema.rbindex fa9dea5a..e662e3be 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.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 databaseenable_extension "pgcrypto"enable_extension "plpgsql"@@ -107,7 +107,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_14_164118) dot.decimal "balance", precision: 19, scale: 4t.string "currency"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: truet.uuid "import_id"t.uuid "plaid_account_id"t.boolean "scheduled_for_deletion", default: false@@ -439,7 +439,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_11_14_164118) dot.datetime "created_at", null: falset.datetime "updated_at", null: falset.string "rate_type"- t.decimal "interest_rate", precision: 10, scale: 2+ t.decimal "interest_rate", precision: 10, scale: 3t.integer "term_months"end