Skip to content
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

add format_number_no_round function #82

Merged
merged 9 commits into from
Aug 1, 2024
Merged

Conversation

joshuadavidthomas
Copy link
Member

No description provided.

Comment on lines 100 to 101
(0, "123.456789"),
(2, "123.456789"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah.. Not in love with the name of the function, which may go a little ways to explain what the purpose is (beyond, you know, some actual docs....).

For display in a template, I needed a quick way to format a dollar amount to two decimal places without rounding.

E.g.

123.4 -> 123.40
123.45 -> 123.45
123.456 -> 123.456
123.4567 -> 123.4567
123.45670 -> 123.4567

and so on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or three decimal places, which is why I added the decimal_places arg. We have some tracts of land that have fractional acres, but the majority are whole numbers. So I wanted to just show 123 if the acres were 123.000, but 123.456 if the acres were 123.456.

I don't think I've actually pushed that local change actually.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to clean it up a bit to clarify things, because even I'm confusing myself thinking through it right now.. 😅

@joshuadavidthomas joshuadavidthomas changed the title add format_decimal_places function add format_number_no_round function Jul 31, 2024
@joshuadavidthomas joshuadavidthomas requested a review from a team as a code owner August 1, 2024 04:34
@joshuadavidthomas joshuadavidthomas merged commit 354d716 into main Aug 1, 2024
16 checks passed
@joshuadavidthomas joshuadavidthomas deleted the format-decimal-places branch August 1, 2024 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants