-
-
Notifications
You must be signed in to change notification settings - Fork 724
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 truncates smallest digit for mL units #12874
Comments
can i work on this |
Yes thank you @bouaik , I'll assign you 👍 |
The issue is mainly form the wrong calculation of unit_presentation in spree_line_items, is't calculated from final_weight_volume which is a decimal with 2 numbers after the decimal point Explication of the issueAlso the problem exist for mg units NoticeI noticed that in line_item model we calculated the unit_value like this and the final_weight_volume like this Since we already have variant.value in unit_value method, why are we calculating final_weight_volume = variant.value * quantity then getting unit_value = final_weight_volume / quantity ? Possible fixI'm suggesting we change the column type to decimal(10, 3) or float if we anticipate smaller units in the future. Also, let's refactor the logic to avoid recalculating unit_value What do you think guys ? |
Hi @bouaik, It makes sense to update the column to decimal(10, 3). As for the calculations , I am sure I am following what you are saying, I'll just point out that the |
Description
Some places in the app are rounding mL units incorrectly.
Expected Behavior
2mL -> should display as 2mL
125mL -> should display as 125mL
Actual Behaviour
2mL -> display as 0mL
125mL -> display as 130mL
Steps to Reproduce
Animated Gif/Screenshot
For 0.2 mL -> displayed as 0mL:
Checkout Summary Step
Order confirmation Page
For 125 mL -> displayed as 130 mL
Workaround
Reports, shopfront and cart display the correct rounding.
Severity
bug-s3: a feature is broken but there is a workaround
Your Environment
Possible Fix
See #12787 (comment)
The text was updated successfully, but these errors were encountered: