mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Avoid rounded with float numbers errors with javascript
0.7/0.001 = 699.9999999999999 Use Math.round() to avoid this.
This commit is contained in:
@@ -48,7 +48,7 @@ angular.module("admin.products").factory "OptionValueNamer", (VariantUnitManager
|
||||
option_value_value_unit_scaled: ->
|
||||
[unit_scale, unit_name] = @scale_for_unit_value()
|
||||
|
||||
value = @variant.unit_value / unit_scale
|
||||
value = Math.round((@variant.unit_value / unit_scale) * 100) / 100
|
||||
|
||||
[value, unit_name]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user