Skip to content

Commit 511aff9

Browse files
Neal Chambersmacanudo527
Neal Chambers
authored andcommitted
Refactor option_value_value_unit_scaled for correct unit value scaling and update sales tax report spec for clarity
1 parent 1d187fa commit 511aff9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/services/variant_units/option_value_namer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def option_value_value_unit
5858
def option_value_value_unit_scaled
5959
unit_scale, unit_name = scale_for_unit_value
6060

61-
value = (@nameable.unit_value / unit_scale).to_d.round(2)
61+
value = (@nameable.unit_value.to_d / unit_scale).round(2)
6262

6363
[value, unit_name]
6464
end

spec/lib/reports/sales_tax_totals_by_order_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@
145145
total = report.total_excl_tax(query_row)
146146

147147
# discounted order total - discounted order tax
148-
expect(total).to eq((BigDecimal('113.3') - 10) - (BigDecimal('3.3') - BigDecimal('0.29')))
148+
# (113.3 - 10) - (3.3 - 0.29)
149+
expect(total).to eq 100.29
149150
end
150151
end
151152
end

0 commit comments

Comments
 (0)