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

Fix rounding issues by upgrading decimal maths library #12950

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ gem "active_model_serializers", "0.8.4"
gem 'activerecord-session_store'
gem 'acts-as-taggable-on'
gem 'angularjs-file-upload-rails', '~> 2.4.1'
gem 'bigdecimal', '3.0.2'
gem 'bigdecimal'
gem 'bootsnap', require: false
gem 'geocoder'
gem 'gmaps4rails'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ GEM
base64 (0.2.0)
bcp47_spec (0.2.1)
bcrypt (3.1.20)
bigdecimal (3.0.2)
bigdecimal (3.1.8)
bindata (2.5.0)
bindex (0.8.1)
bootsnap (1.18.3)
Expand Down Expand Up @@ -865,7 +865,7 @@ DEPENDENCIES
angularjs-rails (= 1.8.0)
arel-helpers (~> 2.12)
aws-sdk-s3
bigdecimal (= 3.0.2)
bigdecimal
bootsnap
bugsnag
bullet
Expand Down
2 changes: 1 addition & 1 deletion app/services/variant_units/option_value_namer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def option_value_value_unit
def option_value_value_unit_scaled
unit_scale, unit_name = scale_for_unit_value

value = (@nameable.unit_value / unit_scale).to_d.truncate(2)
value = (@nameable.unit_value.to_d / unit_scale).round(2)

[value, unit_name]
end
Expand Down
3 changes: 2 additions & 1 deletion spec/lib/reports/sales_tax_totals_by_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
total = report.total_excl_tax(query_row)

# discounted order total - discounted order tax
expect(total).to eq((113.3 - 10) - (3.3 - 0.29))
# (113.3 - 10) - (3.3 - 0.29)
expect(total).to eq 100.29
end
end
end
Expand Down
Loading