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

Default pretty_num() behaviour has changed #92

Closed
cjrace opened this issue Oct 15, 2024 · 0 comments · Fixed by #93
Closed

Default pretty_num() behaviour has changed #92

cjrace opened this issue Oct 15, 2024 · 0 comments · Fixed by #93
Labels
bug Something isn't working

Comments

@cjrace
Copy link
Contributor

cjrace commented Oct 15, 2024

Describe the bug

As of v0.6.0 pretty_num() now forces in two decimal places by default, when before it used to round to 0 dp.

How to reproduce

Steps to reproduce the behaviour:

  1. Run dfeR::pretty_num(2024)
  2. You'll see you now get 2,024.00

Then checkout the previous version of the package:

In a terminal run git checkout tags/v0.5.1 (the previous version)

Then run:

devtools::load_all(".")
dfeR::pretty_num(2024)

You'll see on the older version you get "2,024" as the result.

Expected behaviour

I'd have expected the behaviour to stay consistent through the additions. So I'd expect dfeR::pretty_num(2024) to still return "2,024".

Screenshots

An example where I spotted this - we have some tooltips in a dashboard that used to be rounded to 0 dp, but now have 2 dp forced in afterwards after updating the package, in itself not the end of the world, but slightly odd that we've managed to change the behaviour unexpectedly. This kind of thing could easily be missed by others when updating the package and break what they'd intended to happen.

image

Additional context

  1. I think we should make the default behaviour have 0 decimal places to match what existed before
  2. We should review our test coverage to make sure we're happy we have enough to prevent this kind of breaking change moving forwards
@cjrace cjrace added the bug Something isn't working label Oct 15, 2024
@mzayeddfe mzayeddfe linked a pull request Oct 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant