Skip to content

Convert currency amounts in database to cents - #133

Open
freestylebit wants to merge 5 commits into
mainfrom
pc-convert-to-cents
Open

Convert currency amounts in database to cents#133
freestylebit wants to merge 5 commits into
mainfrom
pc-convert-to-cents

Conversation

@freestylebit

@freestylebit freestylebit commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Addresses #130

The system generally stores data in whole dollar amounts. This could cause issues when we start splitting allocations for different causes (e.g. We allocate $5, then split it equally between two causes; both causes would have $2.50, which the current system would obfuscate the cent detail by either removing it or inflating it depending on whether it rounds down or up respectively).

We still want to make sure we don't run into floating point error, so we store the number of cents as an integer in the database so all values are calculated accurately (provided the US government does not change how many decimal places there are in the dollar). This PR also goes through the view layer to clean up unnecessary formatting in response to this change.

This PR also updates column names to descriptively identify that it stores cents for documentation-sakes.

Comment thread app/models/concerns/money_cents.rb Outdated
@johnpaulashenfelter johnpaulashenfelter added the rubyforgood Work done during the Ruby For Good 2026 Event 😎 label Aug 29, 2026
@freestylebit
freestylebit force-pushed the pc-convert-to-cents branch 2 times, most recently from 73ba091 to ea9659e Compare August 29, 2026 20:13
@freestylebit freestylebit changed the title Convert currency amounts in database to cents Step 2 - Convert currency amounts in database to cents Aug 29, 2026
@freestylebit freestylebit changed the title Step 2 - Convert currency amounts in database to cents Convert currency amounts in database to cents Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rubyforgood Work done during the Ruby For Good 2026 Event 😎

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants