Skip to content

Commit

Permalink
Fix bug: Loan % doesn't allow exact rate (#1492)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
arsenstorm authored Nov 22, 2024
1 parent 571fc4d commit 1c2f075
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/views/loans/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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") } %>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 3 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1c2f075

Please # to comment.