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

Cost calculation is wrong #17

Open
gsipos opened this issue Aug 9, 2018 · 1 comment
Open

Cost calculation is wrong #17

gsipos opened this issue Aug 9, 2018 · 1 comment
Assignees
Labels

Comments

@gsipos
Copy link
Member

gsipos commented Aug 9, 2018

Cost metrics that are above 1000 can be displayed in various ways, like
1 234,567
1.234,567
1,234.567
And it is not currently handled well.

@gsipos gsipos added the bug label Aug 9, 2018
@gsipos gsipos added this to the 1.0 - Initial release milestone Aug 9, 2018
@gsipos gsipos self-assigned this Aug 9, 2018
@fpeter8
Copy link
Collaborator

fpeter8 commented Aug 10, 2018

Proposed solution:
Collect all numbers as string, and try to figure out the format from all of them before the actual parsing takes place (so if there is a single number where we know the format, we can apply it to the others)

  • If it contains two different separators, format is known
  • If it contains a single separator multiple times, format is known (the separator is for the thousand, which can be mapped to the fraction separator)
  • If it contains space, format is known (1 234,567)
  • If it contains a single separator once, and the number after the separator is not 3 digits long, it is a fraction separator

If we don't know the format we should not display a cost estimate as it could be way off.

Possible additional rules (needs checking):

  • If the data is bytes (kB, MB, etc.) it might contain only numbers from a specific range before showing it with the next SI prefix (1024 GB -> 1 TB)
  • If we figure out the locale (browser, or the page itself) we can fall back to the default format of that locale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants