-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transactions and Donations do not allow decimals #1709
Comments
It looks like the |
That's unfortunate.
It might make sense to always round up or down. |
you can use numeric type to round correctly https://www.postgresql.org/docs/16/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL another option is https://github.com/RubyMoney/money-rails and store it as cents w/ bigint. i personally prefer ints to keep it simple since the amounts are often in the thousands and millions :) |
Agreed, but sounds like something that can be solved on the frontend.
Donations on IRS forms often have cents. FEC tracks cents too. I mostly notice from copy and pasting in forms and finding it annoying that I had one more step before I could move on. |
@mooninmyname This issue has the conversation about whether to include cents when tracking donations in the database. |
This is interesting to consider. If we do stick with integers, I wonder if we can add some JavaScript to automatically remove the cents when pasting a number in. |
Definitely a chicken or egg situation. The current implementation seems to have centered this decision on the presentation issue of how the data will look in it's final form, which is something javascript or even the API can solve. But it's somewhat backfired into supporting this increment input (which I think could be removed if switched to decimals). Decimals can always be reformatted programmatically, but you can't put data back that isn't there. If this was the 90s, we might be debating the size of the database on these two decimals, but hopefully this isn't an issue lol. A switch to add cents would probably require a fix to ensure all the places that monetary values show up are rounded in presentation. |
There's always math.round() and listen for keystrokes on the field. |
Definitely a "bug or feature" question, but since the admin team strives for accuracy, it would be reasonable to support 2 decimal places for financial transactions.
The text was updated successfully, but these errors were encountered: