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

Inconsistent rounding on some units #7504

Closed
filipefurtad0 opened this issue Apr 28, 2021 · 5 comments · Fixed by #8180
Closed

Inconsistent rounding on some units #7504

filipefurtad0 opened this issue Apr 28, 2021 · 5 comments · Fixed by #8180
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.

Comments

@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Apr 28, 2021

Description

Closely related to https://github.com/openfoodfoundation/wishlist/issues/6

There's some issues with rounding issues with units like L, inserting a value respective to a given unit appears in the "Display as" field as a decimal, with plenty of significant digits. (see pic/video below). This can easily appear in the shopfront.

A known combination is Volume (L), with value 0.7; others have been observed.

Expected Behavior

Inserting 0.7 should appear as 700 mL.

Actual Behaviour

Inserting 0.7 L appears as 699.99999999.... mL

Steps to Reproduce

  1. Create or edit a Volume (L) product.
  2. Type 0.7 on the "Value" field.
  3. See the "Display as" field.

Animated Gif/Screenshot

Peek 2021-04-21 21-38

This value gets actually gets stored and is even displayed in the shopfront:

image

Update
This issue also appears on the inventory (https://github.com/openfoodfoundation/wishlist/issues/6) and Order Cycles page:
image

Workaround

You can edit the display as field and type any value, overriding the placeholder value.

Severity

bug-s3: a feature is broken but there is a workaround

Your Environment

  • Version used: first spotted here, maybe v3.6.3?
  • Browser name and version: Firefox 88
  • Operating System and version (desktop or mobile): Desktop Ubuntu 20.04

Possible Fix

@filipefurtad0 filipefurtad0 added the bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. label Apr 28, 2021
@lauriewayne lauriewayne added the US Selected to be done by the US active instance label Sep 8, 2021
@jibees jibees self-assigned this Sep 14, 2021
@jibees
Copy link
Contributor

jibees commented Sep 14, 2021

Ahah, ❤️ javascript:

Capture d’écran 2021-09-14 à 10 07 13

@lauriewayne
Copy link
Collaborator

lauriewayne commented Nov 7, 2021

Possibly related but maybe not: when using imperial measures (lbs or oz) we are seeing a similar display problem show up when the "Display as" field is empty (i.e. default/auto generated) and the weight is 12 or 24 (does not happen when the weight is 8, 16, 15, 30, and so on, and does not happen for metric measures or items).

In back end:
Screenshot 2021-11-07 9 21 27 AM

In shop:
image001

When the "Display as" field is manually updated to "12 ounces" in the variant edit, the display looks better:
Screenshot 2021-11-07 10 24 52 AM

But the back end still shows 11.999999999999998 even after manually changing it to 12:
Screenshot 2021-11-07 10 07 32 AM

@lauriewayne lauriewayne reopened this Nov 7, 2021
@lauriewayne
Copy link
Collaborator

Looks like an imperial measures only issue. Moving this comment to openfoodfoundation/wishlist#219.

@drummer83
Copy link
Contributor

drummer83 commented Nov 8, 2023

Oh no, this one is back! 😢

'Display as' and 'edit variant' are ok, but the variants list and the shopfront are not:

image

image

image

image

Reopening!

@filipefurtad0
Copy link
Contributor Author

Closing from merging PR #12950.

@github-project-automation github-project-automation bot moved this from All the things 💤 to Done in OFN Delivery board Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants