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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure the number of fraction digits is correct #15544
Conversation
@sgiehl is there an issue for this? Looking at eg https://builds-artifacts.matomo.org/matomo-org/matomo/4.x-dev/38281/Dashboard_rowevolution.png it was maybe better before? |
No there was no issue. I was preparing to update the PHPUnit version and this test suddenly started to fail as it return
The format function takes two parameters for |
Be just good to not regress UI. Do we have to update PHP Unit? Maybe we could wait with that unless we're after some particular feature? Of course it failing there shows there maybe is some issue which wasn't visible before but might still not be too important? Do we otherwise need to maybe rename that parameter or add some doc to make the current behaviour more clear maybe? |
The behavior is simply inconsistent. Imho we need to adjust the usage of the parameters. In the case you mentioned above it imho would make more sense to set minimum fraction digits to 0. So it would also return |
馃憤 probably need to do this in most places to keep existing behaviour probably? |
I searched through the code, but it looks like we didn't use the minimum fraction digits count anywhere else (besides in tests) |
Tests seem to pass so looks good 馃憤 |
The current behavior when formatting number is a bit inconsistent when the minimum number of fraction digits is set.
Let's assume we have minimum number of fraction digits set to 3. The current fomating would do that:
With the suggested changes the
50
should result in50.000
. There is actually a test covering exact that case, unfortunately it doesn't fail at the moment, as theassertEquals
in the PHPUnit version we are using returns true when comparing50
and50.000
馃し鈥嶁檪(The
assertSame
would actually fail. In newer PHPUnit versions theassertEquals
fails, too)